********************************************************************************
** 	TITLE:		merge_vote		          	               					  **
**	AUTHOR:	    Review version                                                **
**	DATA:       Various datasets                                              **
**	DATE:		December 2022		   				 	                      **
**	VERSION:	Stata 16					                                  **
********************************************************************************

* Version control

version 16.0

* Run do-files

do us1996_anes_integrity
do us2000_anes_integrity
do us2004_anes_integrity
do us2012_anes_integrity
do us2016_anes_integrity
do us2020_anes_integrity

* Open log file

capture log close
log using "merge_integrity_vote", replace

* Merge

use "us1996_anes_integrity.dta", clear

append using us2000_anes_integrity us2004_anes_integrity us2012_anes_integrity us2016_anes_integrity us2020_anes_integrity

replace pid = 2 if pid == 3

gen strength = 0 if pidscale_whole == 2 | pidscale_whole == 3 | pidscale_whole == 5 | pidscale_whole == 6
replace strength = 1 if pidscale_whole == 1 | pidscale_whole == 7

* Election ID

encode election, gen(electionid)

gen caseid = .

replace caseid = 1 if election == "us1996-anes"
replace caseid = 2 if election == "us2000-anes"
replace caseid = 3 if election == "us2004-anes"
replace caseid = 4 if election == "us2012-anes"
replace caseid = 5 if election == "us2016-anes"
replace caseid = 6 if election == "us2020-anes"

* Election year

gen electionyr = .

replace electionyr = 1996 if election == "us1996-anes"
replace electionyr = 2000 if election == "us2000-anes"
replace electionyr = 2004 if election == "us2004-anes"
replace electionyr = 2012 if election == "us2012-anes"
replace electionyr = 2016 if election == "us2016-anes"
replace electionyr = 2020 if election == "us2020-anes"

* Group of elections

gen electiongr = "us1996-2004-anes" if election == "us1996-anes" | election == "us2000-anes" | election == "us2004-anes"
replace electiongr = "us2012-2020-anes" if election == "us2012-anes" | election == "us2016-anes" | election == "us2020-anes"

* Set of elections

gen elset = 1 if election == "us1996-anes" | election == "us2000-anes" | election == "us2004-anes" | electiongr == "us1996-2004-anes"
replace elset = 2 if election == "us2012-anes" | election == "us2016-anes" | election == "us2020-anes" | electiongr == "us2012-2020-anes"

* Post-election dates

gen postdate = strofreal(podate, "%tdCCYYNNDD")
replace postdate = substr(postdate, 1, 4) + "-" + substr(postdate, 5,2) + "-" + substr(postdate, 7, 2)

* Save merged dataset

save "merge_integrity.dta", replace

* Save dataset with correct forecasts by day

savesome election time correct_mean voteactstatus_whole using "correct_mean.dta" , replace

use "correct_mean.dta", clear

gen electionyr = .

replace electionyr = 1996 if election == "us1996-anes"
replace electionyr = 2000 if election == "us2000-anes"
replace electionyr = 2004 if election == "us2004-anes"
replace electionyr = 2012 if election == "us2012-anes"
replace electionyr = 2016 if election == "us2016-anes"
replace electionyr = 2020 if election == "us2020-anes"

drop election

duplicates tag time electionyr, gen(dup)
duplicates drop time electionyr, force
drop dup

replace correct_mean = correct_mean*100

gen partyid = 3

gen vote = correct_mean

save "correct_mean.dta", replace

* Open merged dataset

use "merge_integrity.dta", clear


***************************************************
** MODEL ESTIMATES - SATISFACTION WITH DEMOCRACY **
***************************************************

* 1996 American National Election Study

regress swd_post ib3.voteactstatus_whole economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us96_anes_parmest_MS_vote.dta, replace)
gen sampleMS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_MSXW_vote.dta, replace)
gen sampleMSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
estimates store MSXus96
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_loser_vote.dta, replace)
estimates restore MSXus96
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_novote_vote.dta, replace)
estimates restore MSXus96
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_winner_vote.dta, replace)

* 2000 American National Election Study

regress swd_post ib3.voteactstatus_whole economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us00_anes_parmest_MS_vote.dta, replace)
replace sampleMS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_MSXW_vote.dta, replace)
replace sampleMSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
estimates store MSXus00
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_loser_vote.dta, replace)
estimates restore MSXus00
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_novote_vote.dta, replace)
estimates restore MSXus00
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_winner_vote.dta, replace)

* 2004 American National Election Study

regress swd_post ib3.voteactstatus_whole economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us04_anes_parmest_MS_vote.dta, replace)
replace sampleMS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_MSXW_vote.dta, replace)
replace sampleMSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
estimates store MSXus04
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_loser_vote.dta, replace)
estimates restore MSXus04
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_novote_vote.dta, replace)
estimates restore MSXus04
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_winner_vote.dta, replace)

* 2012 American National Election Study

regress swd_post ib3.voteactstatus_whole economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_MS_vote.dta, replace)
replace sampleMS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_MSXW_vote.dta, replace)
replace sampleMSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MSXus12
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_loser_vote.dta, replace)
estimates restore MSXus12
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_novote_vote.dta, replace)
estimates restore MSXus12
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_winner_vote.dta, replace)

* 2016 American National Election Study

regress swd_post ib3.voteactstatus_whole economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_MS_vote.dta, replace)
replace sampleMS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_MSXW_vote.dta, replace)
replace sampleMSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MSXus16
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_loser_vote.dta, replace)
estimates restore MSXus16
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_novote_vote.dta, replace)
estimates restore MSXus16
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_winner_vote.dta, replace)

* 2020 American National Election Study

regress swd_post ib3.voteactstatus_whole economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_MS_vote.dta, replace)
replace sampleMS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_MSXW_vote.dta, replace)
replace sampleMSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MSXus20
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_loser_vote.dta, replace)
estimates restore MSXus20
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_novote_vote.dta, replace)
estimates restore MSXus20
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_winner_vote.dta, replace)


********************************************************************
** MODEL ESTIMATES ADDING SUSPICION - SATISFACTION WITH DEMOCRACY **
********************************************************************

* 1996 American National Election Study

regress swd_post ib3.voteactstatus_whole cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us96_anes_parmest_post_suspicion_MS_vote.dta, replace)
gen sample_cpost_MSS= 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_post_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_post_suspicion_MSXW_vote.dta, replace)
gen sample_cpost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
estimates store MSXus96_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_post_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus96_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_post_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus96_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_post_suspicion_swd_winner_vote.dta, replace)

* 2000 American National Election Study

regress swd_post ib3.voteactstatus_whole cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us00_anes_parmest_post_suspicion_MS_vote.dta, replace)
replace sample_cpost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_post_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_post_suspicion_MSXW_vote.dta, replace)
replace sample_cpost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
estimates store MSXus00_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_post_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus00_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_post_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus00_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_post_suspicion_swd_winner_vote.dta, replace)

* 2004 American National Election Study

regress swd_post ib3.voteactstatus_whole cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us04_anes_parmest_post_suspicion_MS_vote.dta, replace)
replace sample_cpost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_post_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_post_suspicion_MSXW_vote.dta, replace)
replace sample_cpost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
estimates store MSXus04_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_post_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus04_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_post_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus04_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_post_suspicion_swd_winner_vote.dta, replace)

* 2012 American National Election Study (pre)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_pre_suspicion_MS_vote.dta, replace)
gen sample_cpre_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_pre_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_pre_suspicion_MSXW_vote.dta, replace)
gen sample_cpre_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MSXus12_pre_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_pre_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus12_pre_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_pre_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus12_pre_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_pre_suspicion_swd_winner_vote.dta, replace)

* 2016 American National Election Study (pre)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_pre_suspicion_MS_vote.dta, replace)
replace sample_cpre_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_pre_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_pre_suspicion_MSXW_vote.dta, replace)
replace sample_cpre_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MSXus16_pre_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_pre_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus16_pre_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_pre_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus16_pre_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_pre_suspicion_swd_winner_vote.dta, replace)

* 2020 American National Election Study (pre)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_pre_suspicion_MS_vote.dta, replace)
replace sample_cpre_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_pre_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_pre_suspicion_MSXW_vote.dta, replace)
replace sample_cpre_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MSXus20_pre_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_pre_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus20_pre_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_pre_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus20_pre_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_pre_suspicion_swd_winner_vote.dta, replace)

* 2012-2020 American National Election Studies (pre)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if electiongr == "us2012-2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1220_anes_parmest_pre_suspicion_MS_vote.dta, replace)

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if electiongr == "us2012-2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us1220_anes_parmest_pre_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us1220_anes_parmest_pre_suspicion_MSXW_vote.dta, replace)

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if electiongr == "us2012-2020-anes"
estimates store MSXus1220_pre_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us1220_anes_parmest_pre_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus1220_pre_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us1220_anes_parmest_pre_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus1220_pre_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us1220_anes_parmest_pre_suspicion_swd_winner_vote.dta, replace)

* 2012 American National Election Study (post)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_post_suspicion_MS_vote.dta, replace)
replace sample_cpost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_post_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_post_suspicion_MSXW_vote.dta, replace)
replace sample_cpost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MSXus12_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_post_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus12_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_post_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus12_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_post_suspicion_swd_winner_vote.dta, replace)

* 2016 American National Election Study (post)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_post_suspicion_MS_vote.dta, replace)
replace sample_cpost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_post_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_post_suspicion_MSXW_vote.dta, replace)
replace sample_cpost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MSXus16_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_post_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus16_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_post_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus16_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_post_suspicion_swd_winner_vote.dta, replace)

* 2020 American National Election Study (post)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_post_suspicion_MS_vote.dta, replace)
replace sample_cpost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_post_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_post_suspicion_MSXW_vote.dta, replace)
replace sample_cpost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_post_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MSXus20_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_post_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus20_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_post_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus20_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_post_suspicion_swd_winner_vote.dta, replace)

* 2012 American National Election Study (prepost)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_prepost_suspicion_MS_vote.dta, replace)
gen sample_cprepost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_prepost_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_prepost_suspicion_MSXW_vote.dta, replace)
gen sample_cprepost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MSXus12_prepost_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_prepost_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus12_prepost_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_prepost_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus12_prepost_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_prepost_suspicion_swd_winner_vote.dta, replace)

* 2016 American National Election Study (prepost)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_prepost_suspicion_MS_vote.dta, replace)
replace sample_cprepost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_prepost_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_prepost_suspicion_MSXW_vote.dta, replace)
replace sample_cprepost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MSXus16_prepost_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_prepost_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus16_prepost_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_prepost_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus16_prepost_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_prepost_suspicion_swd_winner_vote.dta, replace)

* 2020 American National Election Study (prepost)

regress swd_post ib3.voteactstatus_whole conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_prepost_suspicion_MS_vote.dta, replace)
replace sample_cprepost_MSS = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_prepost_suspicion_MSXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_prepost_suspicion_MSXW_vote.dta, replace)
replace sample_cprepost_MSSX = 1 if e(sample)==1

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_prepost_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MSXus20_prepost_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_prepost_suspicion_swd_loser_vote.dta, replace)
estimates restore MSXus20_prepost_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_prepost_suspicion_swd_novote_vote.dta, replace)
estimates restore MSXus20_prepost_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_prepost_suspicion_swd_winner_vote.dta, replace)


**************************************************************************************
** MODEL ESTIMATES WITH 3-WAY INTERACTION (SUSPICION) - SATISFACTION WITH DEMOCRACY **
**************************************************************************************

* 2012 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p##c.suspicion economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole, at(suspicion=(0(.1)1) unexpected_p=(0 1))
marginsplot, by(voteactstatus_whole) byopt(title("2012 ANES", size(medlarge) margin(b=3 l=8)) cols(1) legend(off)) subtitle(, size(medlarge)) ytitle("Linear prediction", size(medlarge) margin(r=3 b=2) color(white)) xtitle("Suspicion index", size(medlarge) margin(t=3 l=6) color(black)) ylabel(1(1)4, labsize(large) labcolor(white) tlcolor(white)) xlabel(, labsize(large)) plot1opts(lpattern(dash) lcolor(gs10) mcolor(gs10) msymbol(circle) msize(small)) plot2opts(lpattern(solid) lcolor(black) mcolor(black) msymbol(circle) msize(small)) ci1opts(lpattern(solid) lwidth(thin) lcolor(gs10)) ci2opts(lpattern(solid) lwidth(thin) lcolor(black)) legend(col(2) order(3 "Expected" 4 "Unexpected") symxsize(*.8) rowgap(8) region(lstyle(none))) saving("us12_gap_swd_3x.gph", replace)
graph display, ysize(7) xsize(3)

regress swd_post i.voteactstatus_whole#i.unexpected_p#c.suspicion economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MS3Xus12
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion - 1.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us12_anes_parmest_swd_loser_3x_vote.dta, replace)
estimates restore MS3Xus12
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion - 2.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us12_anes_parmest_swd_novote_3x_vote.dta, replace)
estimates restore MS3Xus12
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion - 3.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us12_anes_parmest_swd_winner_3x_vote.dta, replace)

* 2016 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p##c.suspicion economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole, at(suspicion=(0(.1)1) unexpected_p=(0 1))
marginsplot, by(voteactstatus_whole) byopt(title("2016 ANES", size(medlarge) margin(b=3 l=8)) cols(1) legend(off)) subtitle(, size(medlarge)) ytitle("Linear prediction", size(medlarge) margin(r=3 b=2) color(white)) xtitle("Suspicion index", size(medlarge) margin(t=3 l=6) color(black)) ylabel(1(1)4, labsize(large) labcolor(white) tlcolor(white)) xlabel(, labsize(large)) plot1opts(lpattern(dash) lcolor(gs10) mcolor(gs10) msymbol(circle) msize(small)) plot2opts(lpattern(solid) lcolor(black) mcolor(black) msymbol(circle) msize(small)) ci1opts(lpattern(solid) lwidth(thin) lcolor(gs10)) ci2opts(lpattern(solid) lwidth(thin) lcolor(black)) legend(col(2) order(3 "Expected" 4 "Unexpected") symxsize(*.8) rowgap(8) region(lstyle(none))) saving("us16_gap_swd_3x.gph", replace)
graph display, ysize(7) xsize(3)

regress swd_post i.voteactstatus_whole#i.unexpected_p#c.suspicion economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MS3Xus16
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion - 1.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us16_anes_parmest_swd_loser_3x_vote.dta, replace)
estimates restore MS3Xus16
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion - 2.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us16_anes_parmest_swd_novote_3x_vote.dta, replace)
estimates restore MS3Xus16
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion - 3.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us16_anes_parmest_swd_winner_3x_vote.dta, replace)

* 2020 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p##c.suspicion economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole, at(suspicion=(0(.1)1) unexpected_p=(0 1))
marginsplot, by(voteactstatus_whole) byopt(title("2020 ANES", size(medlarge) margin(b=3 l=8)) cols(1) legend(off)) subtitle(, size(medlarge)) ytitle("Linear prediction", size(medlarge) margin(r=3 b=2) color(white)) xtitle("Suspicion index", size(medlarge) margin(t=3 l=6) color(black)) ylabel(1(1)4, labsize(large) labcolor(white) tlcolor(white)) xlabel(, labsize(large)) plot1opts(lpattern(dash) lcolor(gs10) mcolor(gs10) msymbol(circle) msize(small)) plot2opts(lpattern(solid) lcolor(black) mcolor(black) msymbol(circle) msize(small)) ci1opts(lpattern(solid) lwidth(thin) lcolor(gs10)) ci2opts(lpattern(solid) lwidth(thin) lcolor(black)) legend(col(2) order(3 "Expected" 4 "Unexpected") symxsize(*.8) rowgap(8) region(lstyle(none))) saving("us20_gap_swd_3x.gph", replace)
graph display, ysize(7) xsize(3)

regress swd_post i.voteactstatus_whole#i.unexpected_p#c.suspicion economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MS3Xus20
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion - 1.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_swd_loser_3x_vote.dta, replace)
estimates restore MS3Xus20
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion - 2.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_swd_novote_3x_vote.dta, replace)
estimates restore MS3Xus20
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion - 3.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_swd_winner_3x_vote.dta, replace)


*****************************************************
** MODEL ESTIMATES - PERCEIVED ELECTORAL INTEGRITY **
*****************************************************

* 1996 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us96_anes_parmest_MI_vote.dta, replace)
gen sampleMI = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_MIXW_vote.dta, replace)
gen sample_cpre_MIX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
estimates store MIXus96
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_loser_vote.dta, replace)
estimates restore MIXus96
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_novote_vote.dta, replace)
estimates restore MIXus96
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_winner_vote.dta, replace)

* 2000 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us00_anes_parmest_MI_vote.dta, replace)
replace sampleMI = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_MIXW_vote.dta, replace)
replace sample_cpre_MIX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
estimates store MIXus00
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_loser_vote.dta, replace)
estimates restore MIXus00
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_novote_vote.dta, replace)
estimates restore MIXus00
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_winner_vote.dta, replace)

* 2004 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us04_anes_parmest_MI_vote.dta, replace)
replace sampleMI = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_MIXW_vote.dta, replace)
replace sample_cpre_MIX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
estimates store MIXus04
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_loser_vote.dta, replace)
estimates restore MIXus04
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_novote_vote.dta, replace)
estimates restore MIXus04
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_winner_vote.dta, replace)

* 2012 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_MI_vote.dta, replace)
replace sampleMI = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_MIXW_vote.dta, replace)
replace sample_cpre_MIX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MIXus12
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_loser_vote.dta, replace)
estimates restore MIXus12
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_novote_vote.dta, replace)
estimates restore MIXus12
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_winner_vote.dta, replace)

* 2016 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_MI_vote.dta, replace)
replace sampleMI = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_MIXW_vote.dta, replace)
replace sample_cpre_MIX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MIXus16
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_loser_vote.dta, replace)
estimates restore MIXus16
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_novote_vote.dta, replace)
estimates restore MIXus16
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_winner_vote.dta, replace)

* 2020 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_MI_vote.dta, replace)
replace sampleMI = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_MIXW_vote.dta, replace)
replace sample_cpre_MIX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MIXus20
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_loser_vote.dta, replace)
estimates restore MIXus20
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_novote_vote.dta, replace)
estimates restore MIXus20
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_winner_vote.dta, replace)

* 2020 American National Election Study (pre/post)

regress integrity_4pts accurate ib3.voteactstatus_whole knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_MI_pre_vote.dta, replace)

regress integrity_4pts accurate i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_MIXL_pre_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_MIXW_pre_vote.dta, replace)

regress integrity_4pts accurate i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MIXPus20
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_loser_pre_vote.dta, replace)
estimates restore MIXPus20
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_novote_pre_vote.dta, replace)
estimates restore MIXPus20
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_winner_pre_vote.dta, replace)


**********************************************************************
** MODEL ESTIMATES ADDING SUSPICION - PERCEIVED ELECTORAL INTEGRITY **
**********************************************************************

* 1996 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us96_anes_parmest_post_suspicion_MI_vote.dta, replace)
gen sample_cpost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_post_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us96_anes_parmest_post_suspicion_MIXW_vote.dta, replace)
gen sample_cpost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us1996-anes"
estimates store MIXus96_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_post_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus96_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_post_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus96_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_post_suspicion_integrity_winner_vote.dta, replace)

* 2000 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us00_anes_parmest_post_suspicion_MI_vote.dta, replace)
replace sample_cpost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_post_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us00_anes_parmest_post_suspicion_MIXW_vote.dta, replace)
replace sample_cpost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2000-anes"
estimates store MIXus00_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_post_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus00_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_post_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus00_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_post_suspicion_integrity_winner_vote.dta, replace)

* 2004 American National Election Study

regress integrity_4pts ib3.voteactstatus_whole cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us04_anes_parmest_post_suspicion_MI_vote.dta, replace)
replace sample_cpost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_post_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us04_anes_parmest_post_suspicion_MIXW_vote.dta, replace)
replace sample_cpost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2004-anes"
estimates store MIXus04_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_post_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus04_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_post_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus04_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_post_suspicion_integrity_winner_vote.dta, replace)

* 2012 American National Election Study (pre)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_pre_suspicion_MI_vote.dta, replace)
gen sample_cpre_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_pre_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_pre_suspicion_MIXW_vote.dta, replace)
gen sample_cpre_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MIXus12_pre_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_pre_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus12_pre_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_pre_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus12_pre_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_pre_suspicion_integrity_winner_vote.dta, replace)

* 2016 American National Election Study (pre)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_pre_suspicion_MI_vote.dta, replace)
replace sample_cpre_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_pre_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_pre_suspicion_MIXW_vote.dta, replace)
replace sample_cpre_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MIXus16_pre_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_pre_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus16_pre_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_pre_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus16_pre_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_pre_suspicion_integrity_winner_vote.dta, replace)

* 2020 American National Election Study (pre)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_pre_suspicion_MI_vote.dta, replace)
replace sample_cpre_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_pre_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_pre_suspicion_MIXW_vote.dta, replace)
replace sample_cpre_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MIXus20_pre_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_pre_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus20_pre_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_pre_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus20_pre_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_pre_suspicion_integrity_winner_vote.dta, replace)

* 2012 American National Election Study (post)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_post_suspicion_MI_vote.dta, replace)
replace sample_cpost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_post_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_post_suspicion_MIXW_vote.dta, replace)
replace sample_cpost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MIXus12_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_post_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus12_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_post_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus12_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_post_suspicion_integrity_winner_vote.dta, replace)

* 2016 American National Election Study (post)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_post_suspicion_MI_vote.dta, replace)
replace sample_cpost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_post_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_post_suspicion_MIXW_vote.dta, replace)
replace sample_cpost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MIXus16_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_post_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus16_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_post_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus16_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_post_suspicion_integrity_winner_vote.dta, replace)

* 2020 American National Election Study (post)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_post_suspicion_MI_vote.dta, replace)
replace sample_cpost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_post_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_post_suspicion_MIXW_vote.dta, replace)
replace sample_cpost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_post_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MIXus20_post_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_post_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus20_post_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_post_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus20_post_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_post_suspicion_integrity_winner_vote.dta, replace)

* 2012 American National Election Study (prepost)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us12_anes_parmest_prepost_suspicion_MI_vote.dta, replace)
gen sample_cprepost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_prepost_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us12_anes_parmest_prepost_suspicion_MIXW_vote.dta, replace)
gen sample_cprepost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
estimates store MIXus12_prepost_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_prepost_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus12_prepost_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_prepost_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus12_prepost_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_prepost_suspicion_integrity_winner_vote.dta, replace)

* 2016 American National Election Study (prepost)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us16_anes_parmest_prepost_suspicion_MI_vote.dta, replace)
replace sample_cprepost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_prepost_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us16_anes_parmest_prepost_suspicion_MIXW_vote.dta, replace)
replace sample_cprepost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
estimates store MIXus16_prepost_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_prepost_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus16_prepost_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_prepost_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus16_prepost_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_prepost_suspicion_integrity_winner_vote.dta, replace)

* 2020 American National Election Study (prepost)

regress integrity_4pts ib3.voteactstatus_whole conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us20_anes_parmest_prepost_suspicion_MI_vote.dta, replace)
replace sample_cprepost_MIS = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole##unexpected_p
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_prepost_suspicion_MIXL_vote.dta, replace)
parmest, bmat(r(b)) vmat(r(V)) saving(us20_anes_parmest_prepost_suspicion_MIXW_vote.dta, replace)
replace sample_cprepost_MISX = 1 if e(sample)==1

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_prepost_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MIXus20_prepost_suspicion
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_prepost_suspicion_integrity_loser_vote.dta, replace)
estimates restore MIXus20_prepost_suspicion
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_prepost_suspicion_integrity_novote_vote.dta, replace)
estimates restore MIXus20_prepost_suspicion
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_prepost_suspicion_integrity_winner_vote.dta, replace)


****************************************************************************************
** MODEL ESTIMATES WITH 3-WAY INTERACTION (SUSPICION) - PERCEIVED ELECTORAL INTEGRITY **
****************************************************************************************

* 2012 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p##c.suspicion knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2012-anes"
margins voteactstatus_whole, at(suspicion=(0(.1)1) unexpected_p=(0 1))
marginsplot, by(voteactstatus_whole) byopt(title("2012 ANES", size(medlarge) margin(b=3 l=8)) cols(1) legend(off)) subtitle(, size(medlarge)) ytitle("Linear prediction", size(medlarge) margin(r=3 b=2) color(white)) xtitle("Suspicion index", size(medlarge) margin(t=3 l=6) color(black)) ylabel(1(1)4, labsize(large) labcolor(white) tlcolor(white)) xlabel(, labsize(large)) plot1opts(lpattern(dash) lcolor(gs10) mcolor(gs10) msymbol(circle) msize(small)) plot2opts(lpattern(solid) lcolor(black) mcolor(black) msymbol(circle) msize(small)) ci1opts(lpattern(solid) lwidth(thin) lcolor(gs10)) ci2opts(lpattern(solid) lwidth(thin) lcolor(black)) legend(col(2) order(3 "Expected" 4 "Unexpected") symxsize(*.8) rowgap(8) region(lstyle(none))) saving("us12_gap_integrity_3x.gph", replace)
graph display, ysize(7) xsize(3)

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p#c.suspicion knowledge_n i.male i.white age income education i.region i.electionid if election == "us2012-anes"
estimates store MI3Xus12
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion - 1.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us12_anes_parmest_integrity_loser_3x_vote.dta, replace)
estimates restore MI3Xus12
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion - 2.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us12_anes_parmest_integrity_novote_3x_vote.dta, replace)
estimates restore MI3Xus12
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion - 3.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us12_anes_parmest_integrity_winner_3x_vote.dta, replace)

* 2016 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p##c.suspicion knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2016-anes"
margins voteactstatus_whole, at(suspicion=(0(.1)1) unexpected_p=(0 1))
marginsplot, by(voteactstatus_whole) byopt(title("2016 ANES", size(medlarge) margin(b=3 l=8)) cols(1) legend(off)) subtitle(, size(medlarge)) ytitle("Linear prediction", size(medlarge) margin(r=3 b=2) color(white)) xtitle("Suspicion index", size(medlarge) margin(t=3 l=6) color(black)) ylabel(1(1)4, labsize(large) labcolor(white) tlcolor(white)) xlabel(, labsize(large)) plot1opts(lpattern(dash) lcolor(gs10) mcolor(gs10) msymbol(circle) msize(small)) plot2opts(lpattern(solid) lcolor(black) mcolor(black) msymbol(circle) msize(small)) ci1opts(lpattern(solid) lwidth(thin) lcolor(gs10)) ci2opts(lpattern(solid) lwidth(thin) lcolor(black)) legend(col(2) order(3 "Expected" 4 "Unexpected") symxsize(*.8) rowgap(8) region(lstyle(none))) saving("us16_gap_integrity_3x.gph", replace)
graph display, ysize(7) xsize(3)

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p#c.suspicion knowledge_n i.male i.white age income education i.region i.electionid if election == "us2016-anes"
estimates store MI3Xus16
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion - 1.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us16_anes_parmest_integrity_loser_3x_vote.dta, replace)
estimates restore MI3Xus16
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion - 2.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us16_anes_parmest_integrity_novote_3x_vote.dta, replace)
estimates restore MI3Xus16
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion - 3.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us16_anes_parmest_integrity_winner_3x_vote.dta, replace)

* 2020 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p##c.suspicion knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole, at(suspicion=(0(.1)1) unexpected_p=(0 1))
marginsplot, by(voteactstatus_whole) byopt(title("2020 ANES", size(medlarge) margin(b=3 l=8)) cols(1) legend(off)) subtitle(, size(medlarge)) ytitle("Linear prediction", size(medlarge) margin(r=3 b=2) color(white)) xtitle("Suspicion index", size(medlarge) margin(t=3 l=6) color(black)) ylabel(1(1)4, labsize(large) labcolor(black) tlcolor(black)) xlabel(, labsize(large)) plot1opts(lpattern(dash) lcolor(gs10) mcolor(gs10) msymbol(circle) msize(small)) plot2opts(lpattern(solid) lcolor(black) mcolor(black) msymbol(circle) msize(small)) ci1opts(lpattern(solid) lwidth(thin) lcolor(gs10)) ci2opts(lpattern(solid) lwidth(thin) lcolor(black)) legend(col(2) order(3 "Expected" 4 "Unexpected") symxsize(*.8) rowgap(8) region(lstyle(none))) saving("us20_gap_integrity_3x.gph", replace)
graph display, ysize(7) xsize(3)

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p#c.suspicion knowledge_n i.male i.white age income education i.region i.electionid [pweight=weight] if election == "us2020-anes"
estimates store MI3Xus20
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion - 1.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_integrity_loser_3x_vote.dta, replace)
estimates restore MI3Xus20
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion - 2.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_integrity_novote_3x_vote.dta, replace)
estimates restore MI3Xus20
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion - 3.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_integrity_winner_3x_vote.dta, replace)

* 2020 American National Election Study (pre/post)

regress integrity_4pts accurate i.voteactstatus_whole##i.unexpected_p##c.suspicion knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
margins voteactstatus_whole, at(unexpected_p=(0 1)) atmeans

regress integrity_4pts accurate i.voteactstatus_whole#i.unexpected_p#c.suspicion knowledge_n i.male i.white age income education i.region [pweight=weight] if election == "us2020-anes"
estimates store MI3XPus20
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion - 1.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_integrity_loser_3x_pre_vote.dta, replace)
estimates restore MI3XPus20
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion - 2.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_integrity_novote_3x_pre_vote.dta, replace)
estimates restore MI3XPus20
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion - 3.voteactstatus_whole#0.unexpected_p#c.suspicion
parmest, label saving(us20_anes_parmest_integrity_winner_3x_pre_vote.dta, replace)


********************************************************************
** MODEL ESTIMATES – SATISFACTION WITH DEMOCRACY (CLOSE ELECTION) **
********************************************************************

* 1996 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us1996-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us1996-anes"
estimates store MSXus96c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_loser_close_vote.dta, replace)
estimates restore MSXus96c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_novote_close_vote.dta, replace)
estimates restore MSXus96c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_winner_close_vote.dta, replace)

* 2000 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2000-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2000-anes"
estimates store MSXus00c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_loser_close_vote.dta, replace)
estimates restore MSXus00c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_novote_close_vote.dta, replace)
estimates restore MSXus00c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_winner_close_vote.dta, replace)

* 2004 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2004-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2004-anes"
estimates store MSXus04c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_loser_close_vote.dta, replace)
estimates restore MSXus04c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_novote_close_vote.dta, replace)
estimates restore MSXus04c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_winner_close_vote.dta, replace)

* 1996-2004 American National Election Studies

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if closeness_whole == 0 & electiongr == "us1996-2004-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if closeness_whole == 0 & electiongr == "us1996-2004-anes"
estimates store MSXus9604c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_loser_close_vote.dta, replace)
estimates restore MSXus9604c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_novote_close_vote.dta, replace)
estimates restore MSXus9604c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_winner_close_vote.dta, replace)

* 2012 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2012-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2012-anes"
estimates store MS3Xus12c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_loser_close_vote.dta, replace)
estimates restore MS3Xus12c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_novote_close_vote.dta, replace)
estimates restore MS3Xus12c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_winner_close_vote.dta, replace)

* 2016 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2016-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2016-anes"
estimates store MS3Xus16c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_loser_close_vote.dta, replace)
estimates restore MS3Xus16c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_novote_close_vote.dta, replace)
estimates restore MS3Xus16c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_winner_close_vote.dta, replace)

* 2020 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2020-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2020-anes"
estimates store MS3Xus20c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_loser_close_vote.dta, replace)
estimates restore MS3Xus20c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_novote_close_vote.dta, replace)
estimates restore MS3Xus20c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_winner_close_vote.dta, replace)


******************************************************************
** MODEL ESTIMATES – SATISFACTION WITH DEMOCRACY (EASY VICTORY) **
******************************************************************

* 1996 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us1996-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us1996-anes"
estimates store MSXus96nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_loser_notclose_vote.dta, replace)
estimates restore MSXus96nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_novote_notclose_vote.dta, replace)
estimates restore MSXus96nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_winner_notclose_vote.dta, replace)

* 2000 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2000-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2000-anes"
estimates store MSXus00nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_loser_notclose_vote.dta, replace)
estimates restore MSXus00nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_novote_notclose_vote.dta, replace)
estimates restore MSXus00nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_winner_notclose_vote.dta, replace)

* 2004 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2004-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2004-anes"
estimates store MSXus04nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_loser_notclose_vote.dta, replace)
estimates restore MSXus04nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_novote_notclose_vote.dta, replace)
estimates restore MSXus04nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_winner_notclose_vote.dta, replace)

* 2012 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2012-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2012-anes"
estimates store MS3Xus12nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_loser_notclose_vote.dta, replace)
estimates restore MS3Xus12nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_novote_notclose_vote.dta, replace)
estimates restore MS3Xus12nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_winner_notclose_vote.dta, replace)

* 2016 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2016-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2016-anes"
estimates store MS3Xus16nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_loser_notclose_vote.dta, replace)
estimates restore MS3Xus16nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_novote_notclose_vote.dta, replace)
estimates restore MS3Xus16nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_winner_notclose_vote.dta, replace)

* 2020 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2020-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2020-anes"
estimates store MS3Xus20nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_loser_notclose_vote.dta, replace)
estimates restore MS3Xus20nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_novote_notclose_vote.dta, replace)
estimates restore MS3Xus20nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_winner_notclose_vote.dta, replace)


**********************************************************************
** MODEL ESTIMATES - PERCEIVED ELECTORAL INTEGRITY (CLOSE ELECTION) **
**********************************************************************

* 1996 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us1996-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us1996-anes"
estimates store MIXus96c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_loser_close_vote.dta, replace)
estimates restore MIXus96c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_novote_close_vote.dta, replace)
estimates restore MIXus96c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_winner_close_vote.dta, replace)

* 2000 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2000-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2000-anes"
estimates store MIXus00c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_loser_close_vote.dta, replace)
estimates restore MIXus00c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_novote_close_vote.dta, replace)
estimates restore MIXus00c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_winner_close_vote.dta, replace)

* 2004 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2004-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2004-anes"
estimates store MIXus04c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_loser_close_vote.dta, replace)
estimates restore MIXus04c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_novote_close_vote.dta, replace)
estimates restore MIXus04c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_winner_close_vote.dta, replace)

* 2012 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2012-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2012-anes"
estimates store MI3Xus12c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_loser_close_vote.dta, replace)
estimates restore MI3Xus12c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_novote_close_vote.dta, replace)
estimates restore MI3Xus12c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_winner_close_vote.dta, replace)

* 2016 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2016-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2016-anes"
estimates store MI3Xus16c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_loser_close_vote.dta, replace)
estimates restore MI3Xus16c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_novote_close_vote.dta, replace)
estimates restore MI3Xus16c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_winner_close_vote.dta, replace)

* 2020 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2020-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 0 & election == "us2020-anes"
estimates store MI3Xus20c
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_loser_close_vote.dta, replace)
estimates restore MI3Xus20c
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_novote_close_vote.dta, replace)
estimates restore MI3Xus20c
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_winner_close_vote.dta, replace)


********************************************************************
** MODEL ESTIMATES - PERCEIVED ELECTORAL INTEGRITY (EASY VICTORY) **
********************************************************************

* 1996 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us1996-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us1996-anes"
estimates store MIXus96nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_loser_notclose_vote.dta, replace)
estimates restore MIXus96nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_novote_notclose_vote.dta, replace)
estimates restore MIXus96nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_winner_notclose_vote.dta, replace)

* 2000 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2000-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2000-anes"
estimates store MIXus00nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_loser_notclose_vote.dta, replace)
estimates restore MIXus00nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_novote_notclose_vote.dta, replace)
estimates restore MIXus00nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_winner_notclose_vote.dta, replace)

* 2004 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2004-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2004-anes"
estimates store MIXus04nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_loser_notclose_vote.dta, replace)
estimates restore MIXus04nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_novote_notclose_vote.dta, replace)
estimates restore MIXus04nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_winner_notclose_vote.dta, replace)

* 2012 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2012-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2012-anes"
estimates store MI3Xus12nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_loser_notclose_vote.dta, replace)
estimates restore MI3Xus12nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_novote_notclose_vote.dta, replace)
estimates restore MI3Xus12nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_winner_notclose_vote.dta, replace)

* 2016 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2016-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2016-anes"
estimates store MI3Xus16nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_loser_notclose_vote.dta, replace)
estimates restore MI3Xus16nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_novote_notclose_vote.dta, replace)
estimates restore MI3Xus16nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_winner_notclose_vote.dta, replace)

* 2020 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2020-anes"
regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if closeness_whole == 1 & election == "us2020-anes"
estimates store MI3Xus20nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_loser_notclose_vote.dta, replace)
estimates restore MI3Xus20nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_novote_notclose_vote.dta, replace)
estimates restore MI3Xus20nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_winner_notclose_vote.dta, replace)


*********************************************************************************
** MODEL ESTIMATES – SATISFACTION WITH DEMOCRACY (DOES NOT CARE ABOUT OUTCOME) **
*********************************************************************************

* 1996 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us1996-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us1996-anes"
estimates store MSXus96ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_loser_weak_vote.dta, replace)
estimates restore MSXus96ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_winner_weak_vote.dta, replace)

* 2000 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2000-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2000-anes"
estimates store MSXus00ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_loser_weak_vote.dta, replace)
estimates restore MSXus00ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_winner_weak_vote.dta, replace)

* 2004 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2004-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2004-anes"
estimates store MSXus04ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_loser_weak_vote.dta, replace)
estimates restore MSXus04ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_winner_weak_vote.dta, replace)

* 2012 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2012-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2012-anes"
estimates store MS3Xus12ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_loser_weak_vote.dta, replace)
estimates restore MS3Xus12ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_winner_weak_vote.dta, replace)

* 2016 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2016-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2016-anes"
estimates store MS3Xus16ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_loser_weak_vote.dta, replace)
estimates restore MS3Xus16ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_winner_weak_vote.dta, replace)

* 2020 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2020-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2020-anes"
estimates store MS3Xus20ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_loser_weak_vote.dta, replace)
estimates restore MS3Xus20ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_winner_weak_vote.dta, replace)


*************************************************************************
** MODEL ESTIMATES – SATISFACTION WITH DEMOCRACY (CARES ABOUT OUTCOME) **
*************************************************************************

* 1996 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us1996-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us1996-anes"
estimates store MSXus96i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_loser_strong_vote.dta, replace)
estimates restore MSXus96i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_swd_winner_strong_vote.dta, replace)

* 2000 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2000-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2000-anes"
estimates store MSXus00i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_loser_strong_vote.dta, replace)
estimates restore MSXus00i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_swd_winner_strong_vote.dta, replace)

* 2004 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2004-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2004-anes"
estimates store MSXus04i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_loser_strong_vote.dta, replace)
estimates restore MSXus04i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_swd_winner_strong_vote.dta, replace)

* 2012 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2012-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2012-anes"
estimates store MS3Xus12i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_loser_strong_vote.dta, replace)
estimates restore MS3Xus12i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_swd_winner_strong_vote.dta, replace)

* 2016 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2016-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2016-anes"
estimates store MS3Xus16i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_loser_strong_vote.dta, replace)
estimates restore MS3Xus16i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_swd_winner_strong_vote.dta, replace)

* 2020 American National Election Study

regress swd_post i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2020-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people economy_soc economy_ego knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2020-anes"
estimates store MS3Xus20i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_loser_strong_vote.dta, replace)
estimates restore MS3Xus20i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_swd_winner_strong_vote.dta, replace)


***********************************************************************************
** MODEL ESTIMATES – PERCEIVED ELECTORAL INTEGRITY (DOES NOT CARE ABOUT OUTCOME) **
***********************************************************************************

* 1996 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us1996-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us1996-anes"
estimates store MIXus96ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_loser_weak_vote.dta, replace)
estimates restore MIXus96ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_winner_weak_vote.dta, replace)

* 2000 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2000-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2000-anes"
estimates store MIXus00ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_loser_weak_vote.dta, replace)
estimates restore MIXus00ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_winner_weak_vote.dta, replace)

* 2004 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2004-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2004-anes"
estimates store MIXus04ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_loser_weak_vote.dta, replace)
estimates restore MIXus04ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_winner_weak_vote.dta, replace)

* 2012 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2012-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2012-anes"
estimates store MI3Xus12ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_loser_weak_vote.dta, replace)
estimates restore MI3Xus12ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_winner_weak_vote.dta, replace)

* 2016 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2016-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2012-anes"
estimates store MI3Xus16ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_loser_weak_vote.dta, replace)
estimates restore MI3Xus16ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_winner_weak_vote.dta, replace)

* 2020 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2020-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 0 & election == "us2020-anes"
estimates store MI3Xus20ni
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_loser_weak_vote.dta, replace)
estimates restore MI3Xus20ni
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_winner_weak_vote.dta, replace)


***************************************************************************
** MODEL ESTIMATES – PERCEIVED ELECTORAL INTEGRITY (CARES ABOUT OUTCOME) **
***************************************************************************

* 1996 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us1996-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us1996-anes"
estimates store MIXus96i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_loser_strong_vote.dta, replace)
estimates restore MIXus96i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us96_anes_parmest_integrity_winner_strong_vote.dta, replace)

* 2000 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2000-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2000-anes"
estimates store MIXus00i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_loser_strong_vote.dta, replace)
estimates restore MIXus00i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us00_anes_parmest_integrity_winner_strong_vote.dta, replace)

* 2004 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2004-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2004-anes"
estimates store MIXus04i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_loser_strong_vote.dta, replace)
estimates restore MIXus04i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us04_anes_parmest_integrity_winner_strong_vote.dta, replace)

* 2012 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2012-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2012-anes"
estimates store MI3Xus12i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_loser_strong_vote.dta, replace)
estimates restore MI3Xus12i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us12_anes_parmest_integrity_winner_strong_vote.dta, replace)

* 2016 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2016-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2016-anes"
estimates store MI3Xus16i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_loser_strong_vote.dta, replace)
estimates restore MI3Xus16i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us16_anes_parmest_integrity_winner_strong_vote.dta, replace)

* 2020 American National Election Study

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2020-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p conspiracy_n cynicism_pre_n people knowledge_n i.male i.white age income education i.region [pweight=weight] if strength == 1 & election == "us2020-anes"
estimates store MI3Xus20i
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_loser_strong_vote.dta, replace)
estimates restore MI3Xus20i
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us20_anes_parmest_integrity_winner_strong_vote.dta, replace)


***********************************************************************
** MODEL ESTIMATES – SATISFACTION WITH DEMOCRACY (INCONGRUENT POLLS) **
***********************************************************************

* 1996-2004 American National Election Studies

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us1996-2004-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us1996-2004-anes"
estimates store MSXus9604g
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_loser_incongruent_vote.dta, replace)
estimates restore MSXus9604g
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_novote_incongruent_vote.dta, replace)
estimates restore MSXus9604g
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_winner_incongruent_vote.dta, replace)

* 2012-2020 American National Election Studies

regress swd_post i.voteactstatus_whole##i.unexpected_p##c.suspicion5 economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us2012-2020-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p#c.suspicion5 economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us2012-2020-anes"
estimates store MS3Xus1220g
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 1.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_swd_loser_incongruent_3x_vote.dta, replace)
estimates restore MS3Xus1220g
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 2.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_swd_novote_incongruent_3x_vote.dta, replace)
estimates restore MS3Xus1220g
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 3.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_swd_winner_incongruent_3x_vote.dta, replace)


*********************************************************************
** MODEL ESTIMATES – SATISFACTION WITH DEMOCRACY (CONGRUENT POLLS) **
*********************************************************************

* 1996-2004 American National Election Studies

regress swd_post i.voteactstatus_whole##i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us1996-2004-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us1996-2004-anes"
estimates store MSXus9604nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_loser_congruent_vote.dta, replace)
estimates restore MSXus9604nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_novote_congruent_vote.dta, replace)
estimates restore MSXus9604nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_swd_winner_congruent_vote.dta, replace)

* 2012-2020 American National Election Studies

regress swd_post i.voteactstatus_whole##i.unexpected_p##c.suspicion5 economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us2012-2020-anes"

regress swd_post i.voteactstatus_whole#i.unexpected_p#c.suspicion5 economy_soc economy_ego knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us2012-2020-anes"
estimates store MS3Xus1220nc
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 1.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_swd_loser_congruent_3x_vote.dta, replace)
estimates restore MS3Xus1220nc
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 2.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_swd_novote_congruent_3x_vote.dta, replace)
estimates restore MS3Xus1220nc
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 3.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_swd_winner_congruent_3x_vote.dta, replace)


*************************************************************************
** MODEL ESTIMATES - PERCEIVED ELECTORAL INTEGRITY (INCONGRUENT POLLS) **
*************************************************************************

* 1996-2004 American National Election Studies

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us1996-2004-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us1996-2004-anes"
estimates store MIXus9604g
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_integrity_loser_incongruent_vote.dta, replace)
estimates restore MIXus9604g
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_integrity_novote_incongruent_vote.dta, replace)
estimates restore MIXus9604g
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_integrity_winner_incongruent_vote.dta, replace)

* 2012-2020 American National Election Studies

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p##c.suspicion5 knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us2012-2020-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p#c.suspicion5 knowledge_n i.male i.white age income education i.region i.electionid if congruent == 0 & electiongr == "us2012-2020-anes"
estimates store MI3Xus1220g
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 1.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_integrity_loser_incongruent_3x_vote.dta, replace)
estimates restore MI3Xus1220g
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 2.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_integrity_novote_incongruent_3x_vote.dta, replace)
estimates restore MI3Xus1220g
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 3.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_integrity_winner_incongruent_3x_vote.dta, replace)


***********************************************************************
** MODEL ESTIMATES - PERCEIVED ELECTORAL INTEGRITY (CONGRUENT POLLS) **
***********************************************************************

* 1996-2004 American National Election Studies

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us1996-2004-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us1996-2004-anes"
estimates store MIXus9604nc
lincomest 1.voteactstatus_whole#1.unexpected_p - 1.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_integrity_loser_congruent_vote.dta, replace)
estimates restore MIXus9604nc
lincomest 2.voteactstatus_whole#1.unexpected_p - 2.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_integrity_novote_congruent_vote.dta, replace)
estimates restore MIXus9604nc
lincomest 3.voteactstatus_whole#1.unexpected_p - 3.voteactstatus_whole#0.unexpected_p
parmest, label saving(us9604_anes_parmest_integrity_winner_congruent_vote.dta, replace)

* 2012-2020 American National Election Studies

regress integrity_4pts i.voteactstatus_whole##i.unexpected_p##c.suspicion5 knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us2012-2020-anes"

regress integrity_4pts i.voteactstatus_whole#i.unexpected_p#c.suspicion5 knowledge_n i.male i.white age income education i.region i.electionid if congruent == 1 & electiongr == "us2012-2020-anes"
estimates store MI3Xus1220nc
lincomest 1.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 1.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_integrity_loser_congruent_3x_vote.dta, replace)
estimates restore MI3Xus1220nc
lincomest 2.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 2.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_integrity_novote_congruent_3x_vote.dta, replace)
estimates restore MI3Xus1220nc
lincomest 3.voteactstatus_whole#1.unexpected_p#c.suspicion5 - 3.voteactstatus_whole#0.unexpected_p#c.suspicion5
parmest, label saving(us1220_anes_parmest_integrity_winner_congruent_3x_vote.dta, replace)


***************************************************
** LOSER-WINNER GAP: SATISFACTION WITH DEMOCRACY **
***************************************************

* 1996 American National Election Study

use "us96_anes_parmest_MS_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
save "us96_anes_parmest_MS_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_MS_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
save "us00_anes_parmest_MS_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_MS_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
save "us04_anes_parmest_MS_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_MS_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
save "us12_anes_parmest_pre_suspicion_MS_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_MS_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
save "us16_anes_parmest_pre_suspicion_MS_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_pre_suspicion_MS_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
save "us20_anes_parmest_pre_suspicion_MS_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_MS_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "swd"
save "us12_anes_parmest_MS_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_MS_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "swd"
save "us16_anes_parmest_MS_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_MS_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "swd"
save "us20_anes_parmest_MS_vote.dta", replace

* Append and save

use "us96_anes_parmest_MS_vote.dta", clear
append using "us00_anes_parmest_MS_vote.dta"
append using "us04_anes_parmest_MS_vote.dta"
append using "us12_anes_parmest_pre_suspicion_MS_vote.dta"
append using "us16_anes_parmest_pre_suspicion_MS_vote.dta"
append using "us20_anes_parmest_pre_suspicion_MS_vote.dta"
append using "us12_anes_parmest_MS_vote.dta"
append using "us16_anes_parmest_MS_vote.dta"
append using "us20_anes_parmest_MS_vote.dta"
encode electionid, generate(elid)
save "parmest_gap_swd_vote.dta", replace


*****************************************************
** LOSER-WINNER GAP: PERCEIVED ELECTORAL INTEGRITY **
*****************************************************

* 1996 American National Election Study

use "us96_anes_parmest_MI_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
save "us96_anes_parmest_MI_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_MI_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
save "us00_anes_parmest_MI_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_MI_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
save "us04_anes_parmest_MI_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_MI_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
save "us12_anes_parmest_pre_suspicion_MI_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_MI_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
save "us16_anes_parmest_pre_suspicion_MI_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_pre_suspicion_MI_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
save "us20_anes_parmest_pre_suspicion_MI_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_MI_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "integrity"
save "us12_anes_parmest_MI_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_MI_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "integrity"
save "us16_anes_parmest_MI_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_MI_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "integrity"
save "us20_anes_parmest_MI_vote.dta", replace

* Append and save

use "us96_anes_parmest_MI_vote.dta", clear
append using "us00_anes_parmest_MI_vote.dta"
append using "us04_anes_parmest_MI_vote.dta"
append using "us12_anes_parmest_pre_suspicion_MI_vote.dta"
append using "us16_anes_parmest_pre_suspicion_MI_vote.dta"
append using "us20_anes_parmest_pre_suspicion_MI_vote.dta"
append using "us12_anes_parmest_MI_vote.dta"
append using "us16_anes_parmest_MI_vote.dta"
append using "us20_anes_parmest_MI_vote.dta"
encode electionid, generate(elid)
save "parmest_gap_integrity_vote.dta", replace


*******************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (LOSERS) **
*******************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_loser_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
save "us96_anes_parmest_swd_loser_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_loser_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
save "us00_anes_parmest_swd_loser_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_loser_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
save "us04_anes_parmest_swd_loser_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us12_anes_parmest_pre_suspicion_swd_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us16_anes_parmest_pre_suspicion_swd_loser_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_pre_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us20_anes_parmest_pre_suspicion_swd_loser_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
save "us12_anes_parmest_swd_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
save "us16_anes_parmest_swd_loser_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
save "us20_anes_parmest_swd_loser_vote.dta", replace


********************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (NO VOTE) **
********************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_novote_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
save "us96_anes_parmest_swd_novote_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_novote_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
save "us00_anes_parmest_swd_novote_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_novote_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
save "us04_anes_parmest_swd_novote_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us12_anes_parmest_pre_suspicion_swd_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us16_anes_parmest_pre_suspicion_swd_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_pre_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us20_anes_parmest_pre_suspicion_swd_novote_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
save "us12_anes_parmest_swd_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
save "us16_anes_parmest_swd_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
save "us20_anes_parmest_swd_novote_vote.dta", replace


********************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (WINNERS) **
********************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_winner_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
save "us96_anes_parmest_swd_winner_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_winner_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
save "us00_anes_parmest_swd_winner_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_winner_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
save "us04_anes_parmest_swd_winner_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us12_anes_parmest_pre_suspicion_swd_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us16_anes_parmest_pre_suspicion_swd_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_pre_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us20_anes_parmest_pre_suspicion_swd_winner_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
save "us12_anes_parmest_swd_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
save "us16_anes_parmest_swd_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
save "us20_anes_parmest_swd_winner_vote.dta", replace

* Append and save

use "us96_anes_parmest_swd_loser_vote.dta", clear
append using "us96_anes_parmest_swd_novote_vote.dta"
append using "us96_anes_parmest_swd_winner_vote.dta"
append using "us00_anes_parmest_swd_loser_vote.dta"
append using "us00_anes_parmest_swd_novote_vote.dta"
append using "us00_anes_parmest_swd_winner_vote.dta"
append using "us04_anes_parmest_swd_loser_vote.dta"
append using "us04_anes_parmest_swd_novote_vote.dta"
append using "us04_anes_parmest_swd_winner_vote.dta"
append using "us12_anes_parmest_pre_suspicion_swd_loser_vote.dta"
append using "us12_anes_parmest_pre_suspicion_swd_novote_vote.dta"
append using "us12_anes_parmest_pre_suspicion_swd_winner_vote.dta"
append using "us16_anes_parmest_pre_suspicion_swd_loser_vote.dta"
append using "us16_anes_parmest_pre_suspicion_swd_novote_vote.dta"
append using "us16_anes_parmest_pre_suspicion_swd_winner_vote.dta"
append using "us20_anes_parmest_pre_suspicion_swd_loser_vote.dta"
append using "us20_anes_parmest_pre_suspicion_swd_novote_vote.dta"
append using "us20_anes_parmest_pre_suspicion_swd_winner_vote.dta"
append using "us12_anes_parmest_swd_loser_vote.dta"
append using "us12_anes_parmest_swd_novote_vote.dta"
append using "us12_anes_parmest_swd_winner_vote.dta"
append using "us16_anes_parmest_swd_loser_vote.dta"
append using "us16_anes_parmest_swd_novote_vote.dta"
append using "us16_anes_parmest_swd_winner_vote.dta"
append using "us20_anes_parmest_swd_loser_vote.dta"
append using "us20_anes_parmest_swd_novote_vote.dta"
append using "us20_anes_parmest_swd_winner_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_swd_vote.dta", replace


*********************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (LOSERS) **
*********************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_loser_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
save "us96_anes_parmest_integrity_loser_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_loser_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
save "us00_anes_parmest_integrity_loser_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_loser_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
save "us04_anes_parmest_integrity_loser_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us12_anes_parmest_pre_suspicion_integrity_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us16_anes_parmest_pre_suspicion_integrity_loser_vote.dta", replace

* 2012 American National Election Study

use "us20_anes_parmest_pre_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us20_anes_parmest_pre_suspicion_integrity_loser_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
save "us12_anes_parmest_integrity_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
save "us16_anes_parmest_integrity_loser_vote.dta", replace

* 2012 American National Election Study

use "us20_anes_parmest_integrity_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
save "us20_anes_parmest_integrity_loser_vote.dta", replace


**********************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (NO VOTE) **
**********************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_novote_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
save "us96_anes_parmest_integrity_novote_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_novote_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
save "us00_anes_parmest_integrity_novote_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_novote_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
save "us04_anes_parmest_integrity_novote_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us12_anes_parmest_pre_suspicion_integrity_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us16_anes_parmest_pre_suspicion_integrity_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_pre_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us20_anes_parmest_pre_suspicion_integrity_novote_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
save "us12_anes_parmest_integrity_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
save "us16_anes_parmest_integrity_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
save "us20_anes_parmest_integrity_novote_vote.dta", replace


**********************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (WINNERS) **
**********************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_winner_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
save "us96_anes_parmest_integrity_winner_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_winner_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
save "us00_anes_parmest_integrity_winner_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_winner_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
save "us04_anes_parmest_integrity_winner_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_pre_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us12_anes_parmest_pre_suspicion_integrity_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_pre_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us16_anes_parmest_pre_suspicion_integrity_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_pre_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us20_anes_parmest_pre_suspicion_integrity_winner_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
save "us12_anes_parmest_integrity_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
save "us16_anes_parmest_integrity_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
save "us20_anes_parmest_integrity_winner_vote.dta", replace

* Append and save

use "us96_anes_parmest_integrity_loser_vote.dta", clear
append using "us96_anes_parmest_integrity_novote_vote.dta"
append using "us96_anes_parmest_integrity_winner_vote.dta"
append using "us00_anes_parmest_integrity_loser_vote.dta"
append using "us00_anes_parmest_integrity_novote_vote.dta"
append using "us00_anes_parmest_integrity_winner_vote.dta"
append using "us04_anes_parmest_integrity_loser_vote.dta"
append using "us04_anes_parmest_integrity_novote_vote.dta"
append using "us04_anes_parmest_integrity_winner_vote.dta"
append using "us12_anes_parmest_integrity_loser_vote.dta"
append using "us12_anes_parmest_integrity_novote_vote.dta"
append using "us12_anes_parmest_integrity_winner_vote.dta"
append using "us16_anes_parmest_integrity_loser_vote.dta"
append using "us16_anes_parmest_integrity_novote_vote.dta"
append using "us16_anes_parmest_integrity_winner_vote.dta"
append using "us20_anes_parmest_integrity_loser_vote.dta"
append using "us20_anes_parmest_integrity_novote_vote.dta"
append using "us20_anes_parmest_integrity_winner_vote.dta"
append using "us12_anes_parmest_pre_suspicion_integrity_loser_vote.dta"
append using "us12_anes_parmest_pre_suspicion_integrity_novote_vote.dta"
append using "us12_anes_parmest_pre_suspicion_integrity_winner_vote.dta"
append using "us16_anes_parmest_pre_suspicion_integrity_loser_vote.dta"
append using "us16_anes_parmest_pre_suspicion_integrity_novote_vote.dta"
append using "us16_anes_parmest_pre_suspicion_integrity_winner_vote.dta"
append using "us20_anes_parmest_pre_suspicion_integrity_loser_vote.dta"
append using "us20_anes_parmest_pre_suspicion_integrity_novote_vote.dta"
append using "us20_anes_parmest_pre_suspicion_integrity_winner_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_integrity_vote.dta", replace


******************************************************************************************************
** EXPECTED-UNEXPECTED GAP FROM 3-WAY INTERACTION (SUSPICION): SATISFACTION WITH DEMOCRACY (LOSERS) **
******************************************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_swd_loser_3x_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us12_anes_parmest_swd_loser_3x_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_loser_3x_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us16_anes_parmest_swd_loser_3x_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_loser_3x_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us20_anes_parmest_swd_loser_3x_vote.dta", replace


*******************************************************************************************************
** EXPECTED-UNEXPECTED GAP FROM 3-WAY INTERACTION (SUSPICION): SATISFACTION WITH DEMOCRACY (NO VOTE) **
*******************************************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_swd_novote_3x_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us12_anes_parmest_swd_novote_3x_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_novote_3x_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us16_anes_parmest_swd_novote_3x_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_novote_3x_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us20_anes_parmest_swd_novote_3x_vote.dta", replace


*******************************************************************************************************
** EXPECTED-UNEXPECTED GAP FROM 3-WAY INTERACTION (SUSPICION): SATISFACTION WITH DEMOCRACY (WINNERS) **
*******************************************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_swd_winner_3x_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us12_anes_parmest_swd_winner_3x_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_winner_3x_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us16_anes_parmest_swd_winner_3x_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_winner_3x_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us20_anes_parmest_swd_winner_3x_vote.dta", replace

* Append and save

use "us96_anes_parmest_swd_loser_vote.dta", clear
append using "us96_anes_parmest_swd_novote_vote.dta"
append using "us96_anes_parmest_swd_winner_vote.dta"
append using "us00_anes_parmest_swd_loser_vote.dta"
append using "us00_anes_parmest_swd_novote_vote.dta"
append using "us00_anes_parmest_swd_winner_vote.dta"
append using "us04_anes_parmest_swd_loser_vote.dta"
append using "us04_anes_parmest_swd_novote_vote.dta"
append using "us04_anes_parmest_swd_winner_vote.dta"
append using "us12_anes_parmest_swd_loser_3x_vote.dta"
append using "us12_anes_parmest_swd_novote_3x_vote.dta"
append using "us12_anes_parmest_swd_winner_3x_vote.dta"
append using "us16_anes_parmest_swd_loser_3x_vote.dta"
append using "us16_anes_parmest_swd_novote_3x_vote.dta"
append using "us16_anes_parmest_swd_winner_3x_vote.dta"
append using "us20_anes_parmest_swd_loser_3x_vote.dta"
append using "us20_anes_parmest_swd_novote_3x_vote.dta"
append using "us20_anes_parmest_swd_winner_3x_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_swd_3x_vote.dta", replace


********************************************************************************************************
** EXPECTED-UNEXPECTED GAP FROM 3-WAY INTERACTION (SUSPICION): PERCEIVED ELECTORAL INTEGRITY (LOSERS) **
********************************************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_integrity_loser_3x_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us12_anes_parmest_integrity_loser_3x_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_loser_3x_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us16_anes_parmest_integrity_loser_3x_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_loser_3x_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us20_anes_parmest_integrity_loser_3x_vote.dta", replace


*********************************************************************************************************
** EXPECTED-UNEXPECTED GAP FROM 3-WAY INTERACTION (SUSPICION): PERCEIVED ELECTORAL INTEGRITY (NO VOTE) **
*********************************************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_integrity_novote_3x_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us12_anes_parmest_integrity_novote_3x_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_novote_3x_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us16_anes_parmest_integrity_novote_3x_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_novote_3x_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us20_anes_parmest_integrity_novote_3x_vote.dta", replace


*********************************************************************************************************
** EXPECTED-UNEXPECTED GAP FROM 3-WAY INTERACTION (SUSPICION): PERCEIVED ELECTORAL INTEGRITY (WINNERS) **
*********************************************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_integrity_winner_3x_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us12_anes_parmest_integrity_winner_3x_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_winner_3x_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us16_anes_parmest_integrity_winner_3x_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_winner_3x_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us20_anes_parmest_integrity_winner_3x_vote.dta", replace

* Append and save

use "us96_anes_parmest_integrity_loser_vote.dta", clear
append using "us96_anes_parmest_integrity_novote_vote.dta"
append using "us96_anes_parmest_integrity_winner_vote.dta"
append using "us00_anes_parmest_integrity_loser_vote.dta"
append using "us00_anes_parmest_integrity_novote_vote.dta"
append using "us00_anes_parmest_integrity_winner_vote.dta"
append using "us04_anes_parmest_integrity_loser_vote.dta"
append using "us04_anes_parmest_integrity_novote_vote.dta"
append using "us04_anes_parmest_integrity_winner_vote.dta"
append using "us12_anes_parmest_integrity_loser_3x_vote.dta"
append using "us12_anes_parmest_integrity_novote_3x_vote.dta"
append using "us12_anes_parmest_integrity_winner_3x_vote.dta"
append using "us16_anes_parmest_integrity_loser_3x_vote.dta"
append using "us16_anes_parmest_integrity_novote_3x_vote.dta"
append using "us16_anes_parmest_integrity_winner_3x_vote.dta"
append using "us20_anes_parmest_integrity_loser_3x_vote.dta"
append using "us20_anes_parmest_integrity_novote_3x_vote.dta"
append using "us20_anes_parmest_integrity_winner_3x_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_integrity_3x_vote.dta", replace


*************************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (LOSERS, CLOSE ELECTION) **
*************************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_loser_close_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen close = "close"
save "us96_anes_parmest_integrity_loser_close_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_loser_close_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen close = "close"
save "us00_anes_parmest_integrity_loser_close_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_loser_close_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen close = "close"
save "us04_anes_parmest_integrity_loser_close_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_loser_close_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen close = "close"
save "us12_anes_parmest_integrity_loser_close_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_loser_close_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen close = "close"
save "us16_anes_parmest_integrity_loser_close_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_loser_close_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen close = "close"
save "us20_anes_parmest_integrity_loser_close_vote.dta", replace


**************************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (NO VOTE, CLOSE ELECTION) **
**************************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_novote_close_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "close"
save "us96_anes_parmest_integrity_novote_close_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_novote_close_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "close"
save "us00_anes_parmest_integrity_novote_close_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_novote_close_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "close"
save "us04_anes_parmest_integrity_novote_close_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_novote_close_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "close"
save "us12_anes_parmest_integrity_novote_close_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_novote_close_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "close"
save "us16_anes_parmest_integrity_novote_close_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_novote_close_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "close"
save "us20_anes_parmest_integrity_novote_close_vote.dta", replace


**************************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (WINNERS, CLOSE ELECTION) **
**************************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_winner_close_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen close = "close"
save "us96_anes_parmest_integrity_winner_close_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_winner_close_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen close = "close"
save "us00_anes_parmest_integrity_winner_close_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_winner_close_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen close = "close"
save "us04_anes_parmest_integrity_winner_close_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_winner_close_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen close = "close"
save "us12_anes_parmest_integrity_winner_close_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_winner_close_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen close = "close"
save "us16_anes_parmest_integrity_winner_close_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_winner_close_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen close = "close"
save "us20_anes_parmest_integrity_winner_close_vote.dta", replace


***********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (LOSERS, EASY VICTORY) **
***********************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_loser_notclose_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen close = "notclose"
save "us96_anes_parmest_integrity_loser_notclose_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_loser_notclose_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen close = "notclose"
save "us00_anes_parmest_integrity_loser_notclose_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_loser_notclose_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen close = "notclose"
save "us04_anes_parmest_integrity_loser_notclose_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_loser_notclose_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen close = "notclose"
save "us12_anes_parmest_integrity_loser_notclose_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_loser_notclose_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen close = "notclose"
save "us16_anes_parmest_integrity_loser_notclose_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_loser_notclose_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen close = "notclose"
save "us20_anes_parmest_integrity_loser_notclose_vote.dta", replace


************************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (NO VOTE, EASY VICTORY) **
************************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_novote_notclose_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "notclose"
save "us96_anes_parmest_integrity_novote_notclose_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_novote_notclose_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "notclose"
save "us00_anes_parmest_integrity_novote_notclose_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_novote_notclose_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "notclose"
save "us04_anes_parmest_integrity_novote_notclose_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_novote_notclose_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "notclose"
save "us12_anes_parmest_integrity_novote_notclose_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_novote_notclose_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "notclose"
save "us16_anes_parmest_integrity_novote_notclose_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_novote_notclose_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen close = "notclose"
save "us20_anes_parmest_integrity_novote_notclose_vote.dta", replace


************************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (WINNERS, EASY VICTORY) **
************************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_winner_notclose_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen close = "notclose"
save "us96_anes_parmest_integrity_winner_notclose_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_winner_notclose_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen close = "notclose"
save "us00_anes_parmest_integrity_winner_notclose_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_winner_notclose_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen close = "notclose"
save "us04_anes_parmest_integrity_winner_notclose_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_winner_notclose_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen close = "notclose"
save "us12_anes_parmest_integrity_winner_notclose_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_winner_notclose_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen close = "notclose"
save "us16_anes_parmest_integrity_winner_notclose_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_winner_notclose_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen close = "notclose"
save "us20_anes_parmest_integrity_winner_notclose_vote.dta", replace

* Append and save

use "us96_anes_parmest_integrity_loser_close_vote.dta", clear
append using "us96_anes_parmest_integrity_novote_close_vote.dta"
append using "us96_anes_parmest_integrity_winner_close_vote.dta"
append using "us96_anes_parmest_integrity_loser_notclose_vote.dta"
append using "us96_anes_parmest_integrity_novote_notclose_vote.dta"
append using "us96_anes_parmest_integrity_winner_notclose_vote.dta"
append using "us00_anes_parmest_integrity_loser_close_vote.dta"
append using "us00_anes_parmest_integrity_novote_close_vote.dta"
append using "us00_anes_parmest_integrity_winner_close_vote.dta"
append using "us00_anes_parmest_integrity_loser_notclose_vote.dta"
append using "us00_anes_parmest_integrity_novote_notclose_vote.dta"
append using "us00_anes_parmest_integrity_winner_notclose_vote.dta"
append using "us04_anes_parmest_integrity_loser_close_vote.dta"
append using "us04_anes_parmest_integrity_novote_close_vote.dta"
append using "us04_anes_parmest_integrity_winner_close_vote.dta"
append using "us04_anes_parmest_integrity_loser_notclose_vote.dta"
append using "us04_anes_parmest_integrity_novote_notclose_vote.dta"
append using "us04_anes_parmest_integrity_winner_notclose_vote.dta"
append using "us12_anes_parmest_integrity_loser_close_vote.dta"
append using "us12_anes_parmest_integrity_novote_close_vote.dta"
append using "us12_anes_parmest_integrity_winner_close_vote.dta"
append using "us12_anes_parmest_integrity_loser_notclose_vote.dta"
append using "us12_anes_parmest_integrity_novote_notclose_vote.dta"
append using "us12_anes_parmest_integrity_winner_notclose_vote.dta"
append using "us16_anes_parmest_integrity_loser_close_vote.dta"
append using "us16_anes_parmest_integrity_novote_close_vote.dta"
append using "us16_anes_parmest_integrity_winner_close_vote.dta"
append using "us16_anes_parmest_integrity_loser_notclose_vote.dta"
append using "us16_anes_parmest_integrity_novote_notclose_vote.dta"
append using "us16_anes_parmest_integrity_winner_notclose_vote.dta"
append using "us20_anes_parmest_integrity_loser_close_vote.dta"
append using "us20_anes_parmest_integrity_novote_close_vote.dta"
append using "us20_anes_parmest_integrity_winner_close_vote.dta"
append using "us20_anes_parmest_integrity_loser_notclose_vote.dta"
append using "us20_anes_parmest_integrity_novote_notclose_vote.dta"
append using "us20_anes_parmest_integrity_winner_notclose_vote.dta"
encode electionid, generate(elid)
gen closeness = 0 if close == "close"
replace closeness = 1 if close == "notclose"
save "parmest_inter_integrity_closeness_vote.dta", replace


***********************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (LOSERS, CLOSE ELECTION) **
***********************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_loser_close_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen close = "close"
save "us96_anes_parmest_swd_loser_close_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_loser_close_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen close = "close"
save "us00_anes_parmest_swd_loser_close_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_loser_close_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen close = "close"
save "us04_anes_parmest_swd_loser_close_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_loser_close_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen close = "close"
save "us12_anes_parmest_swd_loser_close_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_loser_close_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen close = "close"
save "us16_anes_parmest_swd_loser_close_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_loser_close_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen close = "close"
save "us20_anes_parmest_swd_loser_close_vote.dta", replace


************************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (NO VOTE, CLOSE ELECTION) **
************************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_novote_close_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen close = "close"
save "us96_anes_parmest_swd_novote_close_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_novote_close_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen close = "close"
save "us00_anes_parmest_swd_novote_close_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_novote_close_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen close = "close"
save "us04_anes_parmest_swd_novote_close_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_novote_close_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen close = "close"
save "us12_anes_parmest_swd_novote_close_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_novote_close_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen close = "close"
save "us16_anes_parmest_swd_novote_close_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_novote_close_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen close = "close"
save "us20_anes_parmest_swd_novote_close_vote.dta", replace


************************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (WINNERS, CLOSE ELECTION) **
************************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_winner_close_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen close = "close"
save "us96_anes_parmest_swd_winner_close_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_winner_close_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen close = "close"
save "us00_anes_parmest_swd_winner_close_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_winner_close_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen close = "close"
save "us04_anes_parmest_swd_winner_close_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_winner_close_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen close = "close"
save "us12_anes_parmest_swd_winner_close_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_winner_close_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen close = "close"
save "us16_anes_parmest_swd_winner_close_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_winner_close_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen close = "close"
save "us20_anes_parmest_swd_winner_close_vote.dta", replace


*********************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (LOSERS, EASY VICTORY) **
*********************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_loser_notclose_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen close = "notclose"
save "us96_anes_parmest_swd_loser_notclose_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_loser_notclose_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen close = "notclose"
save "us00_anes_parmest_swd_loser_notclose_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_loser_notclose_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen close = "notclose"
save "us04_anes_parmest_swd_loser_notclose_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_loser_notclose_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen close = "notclose"
save "us12_anes_parmest_swd_loser_notclose_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_loser_notclose_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen close = "notclose"
save "us16_anes_parmest_swd_loser_notclose_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_loser_notclose_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen close = "notclose"
save "us20_anes_parmest_swd_loser_notclose_vote.dta", replace


**********************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (NO VOTE, EASY VICTORY) **
**********************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_novote_notclose_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen close = "notclose"
save "us96_anes_parmest_swd_novote_notclose_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_novote_notclose_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen close = "notclose"
save "us00_anes_parmest_swd_novote_notclose_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_novote_notclose_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen close = "notclose"
save "us04_anes_parmest_swd_novote_notclose_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_novote_notclose_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen close = "notclose"
save "us12_anes_parmest_swd_novote_notclose_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_novote_notclose_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen close = "notclose"
save "us16_anes_parmest_swd_novote_notclose_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_novote_notclose_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen close = "notclose"
save "us20_anes_parmest_swd_novote_notclose_vote.dta", replace


**********************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (WINNERS, EASY VICTORY) **
**********************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_winner_notclose_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen close = "notclose"
save "us96_anes_parmest_swd_winner_notclose_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_winner_notclose_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen close = "notclose"
save "us00_anes_parmest_swd_winner_notclose_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_winner_notclose_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen close = "notclose"
save "us04_anes_parmest_swd_winner_notclose_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_winner_notclose_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen close = "notclose"
save "us12_anes_parmest_swd_winner_notclose_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_winner_notclose_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen close = "notclose"
save "us16_anes_parmest_swd_winner_notclose_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_winner_notclose_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen close = "notclose"
save "us20_anes_parmest_swd_winner_notclose_vote.dta", replace

* Append and save

use "us96_anes_parmest_swd_loser_close_vote.dta", clear
append using "us96_anes_parmest_swd_novote_close_vote.dta"
append using "us96_anes_parmest_swd_winner_close_vote.dta"
append using "us96_anes_parmest_swd_loser_notclose_vote.dta"
append using "us96_anes_parmest_swd_novote_notclose_vote.dta"
append using "us96_anes_parmest_swd_winner_notclose_vote.dta"
append using "us00_anes_parmest_swd_loser_close_vote.dta"
append using "us00_anes_parmest_swd_novote_close_vote.dta"
append using "us00_anes_parmest_swd_winner_close_vote.dta"
append using "us00_anes_parmest_swd_loser_notclose_vote.dta"
append using "us00_anes_parmest_swd_novote_notclose_vote.dta"
append using "us00_anes_parmest_swd_winner_notclose_vote.dta"
append using "us04_anes_parmest_swd_loser_close_vote.dta"
append using "us04_anes_parmest_swd_novote_close_vote.dta"
append using "us04_anes_parmest_swd_winner_close_vote.dta"
append using "us04_anes_parmest_swd_loser_notclose_vote.dta"
append using "us04_anes_parmest_swd_novote_notclose_vote.dta"
append using "us04_anes_parmest_swd_winner_notclose_vote.dta"
append using "us12_anes_parmest_swd_loser_close_vote.dta"
append using "us12_anes_parmest_swd_novote_close_vote.dta"
append using "us12_anes_parmest_swd_winner_close_vote.dta"
append using "us12_anes_parmest_swd_loser_notclose_vote.dta"
append using "us12_anes_parmest_swd_novote_notclose_vote.dta"
append using "us12_anes_parmest_swd_winner_notclose_vote.dta"
append using "us16_anes_parmest_swd_loser_close_vote.dta"
append using "us16_anes_parmest_swd_novote_close_vote.dta"
append using "us16_anes_parmest_swd_winner_close_vote.dta"
append using "us16_anes_parmest_swd_loser_notclose_vote.dta"
append using "us16_anes_parmest_swd_novote_notclose_vote.dta"
append using "us16_anes_parmest_swd_winner_notclose_vote.dta"
append using "us20_anes_parmest_swd_loser_close_vote.dta"
append using "us20_anes_parmest_swd_novote_close_vote.dta"
append using "us20_anes_parmest_swd_winner_close_vote.dta"
append using "us20_anes_parmest_swd_loser_notclose_vote.dta"
append using "us20_anes_parmest_swd_novote_notclose_vote.dta"
append using "us20_anes_parmest_swd_winner_notclose_vote.dta"
encode electionid, generate(elid)
gen closeness = 0 if close == "close"
replace closeness = 1 if close == "notclose"
save "parmest_inter_swd_closeness_vote.dta", replace


*******************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (LOSERS, NOT CARE) **
*******************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_loser_weak_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen strength = "weak"
save "us96_anes_parmest_integrity_loser_weak_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_loser_weak_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen strength = "weak"
save "us00_anes_parmest_integrity_loser_weak_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_loser_weak_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen strength = "weak"
save "us04_anes_parmest_integrity_loser_weak_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_loser_weak_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen strength = "weak"
save "us12_anes_parmest_integrity_loser_weak_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_loser_weak_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen strength = "weak"
save "us16_anes_parmest_integrity_loser_weak_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_loser_weak_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen strength = "weak"
save "us20_anes_parmest_integrity_loser_weak_vote.dta", replace


********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (WINNERS, NOT CARE) **
********************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_winner_weak_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen strength = "weak"
save "us96_anes_parmest_integrity_winner_weak_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_winner_weak_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen strength = "weak"
save "us00_anes_parmest_integrity_winner_weak_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_winner_weak_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen strength = "weak"
save "us04_anes_parmest_integrity_winner_weak_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_winner_weak_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen strength = "weak"
save "us12_anes_parmest_integrity_winner_weak_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_winner_weak_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen strength = "weak"
save "us16_anes_parmest_integrity_winner_weak_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_winner_weak_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen strength = "weak"
save "us20_anes_parmest_integrity_winner_weak_vote.dta", replace


***************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (LOSERS, CARE) **
***************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_loser_strong_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen strength = "strong"
save "us96_anes_parmest_integrity_loser_strong_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_loser_strong_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen strength = "strong"
save "us00_anes_parmest_integrity_loser_strong_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_loser_strong_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen strength = "strong"
save "us04_anes_parmest_integrity_loser_strong_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_loser_strong_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen strength = "strong"
save "us12_anes_parmest_integrity_loser_strong_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_loser_strong_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen strength = "strong"
save "us16_anes_parmest_integrity_loser_strong_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_loser_strong_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen strength = "strong"
save "us20_anes_parmest_integrity_loser_strong_vote.dta", replace


****************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (WINNERS, CARE) **
****************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_integrity_winner_strong_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen strength = "strong"
save "us96_anes_parmest_integrity_winner_strong_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_integrity_winner_strong_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen strength = "strong"
save "us00_anes_parmest_integrity_winner_strong_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_integrity_winner_strong_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen strength = "strong"
save "us04_anes_parmest_integrity_winner_strong_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_integrity_winner_strong_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen strength = "strong"
save "us12_anes_parmest_integrity_winner_strong_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_integrity_winner_strong_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen strength = "strong"
save "us16_anes_parmest_integrity_winner_strong_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_integrity_winner_strong_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen strength = "strong"
save "us20_anes_parmest_integrity_winner_strong_vote.dta", replace

* Append and save

use "us96_anes_parmest_integrity_loser_weak_vote.dta", clear
append using "us96_anes_parmest_integrity_winner_weak_vote.dta"
append using "us96_anes_parmest_integrity_loser_strong_vote.dta"
append using "us96_anes_parmest_integrity_winner_strong_vote.dta"
append using "us00_anes_parmest_integrity_loser_weak_vote.dta"
append using "us00_anes_parmest_integrity_winner_weak_vote.dta"
append using "us00_anes_parmest_integrity_loser_strong_vote.dta"
append using "us00_anes_parmest_integrity_winner_strong_vote.dta"
append using "us04_anes_parmest_integrity_loser_weak_vote.dta"
append using "us04_anes_parmest_integrity_winner_weak_vote.dta"
append using "us04_anes_parmest_integrity_loser_strong_vote.dta"
append using "us04_anes_parmest_integrity_winner_strong_vote.dta"
append using "us12_anes_parmest_integrity_loser_weak_vote.dta"
append using "us12_anes_parmest_integrity_winner_weak_vote.dta"
append using "us12_anes_parmest_integrity_loser_strong_vote.dta"
append using "us12_anes_parmest_integrity_winner_strong_vote.dta"
append using "us16_anes_parmest_integrity_loser_weak_vote.dta"
append using "us16_anes_parmest_integrity_winner_weak_vote.dta"
append using "us16_anes_parmest_integrity_loser_strong_vote.dta"
append using "us16_anes_parmest_integrity_winner_strong_vote.dta"
append using "us20_anes_parmest_integrity_loser_weak_vote.dta"
append using "us20_anes_parmest_integrity_winner_weak_vote.dta"
append using "us20_anes_parmest_integrity_loser_strong_vote.dta"
append using "us20_anes_parmest_integrity_winner_strong_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_integrity_strength_vote.dta", replace


*****************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (LOSERS, NOT CARE) **
*****************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_loser_weak_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen strength = "weak"
save "us96_anes_parmest_swd_loser_weak_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_loser_weak_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen strength = "weak"
save "us00_anes_parmest_swd_loser_weak_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_loser_weak_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen strength = "weak"
save "us04_anes_parmest_swd_loser_weak_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_loser_weak_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen strength = "weak"
save "us12_anes_parmest_swd_loser_weak_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_loser_weak_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen strength = "weak"
save "us16_anes_parmest_swd_loser_weak_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_loser_weak_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen strength = "weak"
save "us20_anes_parmest_swd_loser_weak_vote.dta", replace


******************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (WINNERS, NOT CARE) **
******************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_winner_weak_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen strength = "weak"
save "us96_anes_parmest_swd_winner_weak_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_winner_weak_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen strength = "weak"
save "us00_anes_parmest_swd_winner_weak_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_winner_weak_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen strength = "weak"
save "us04_anes_parmest_swd_winner_weak_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_winner_weak_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen strength = "weak"
save "us12_anes_parmest_swd_winner_weak_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_winner_weak_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen strength = "weak"
save "us16_anes_parmest_swd_winner_weak_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_winner_weak_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen strength = "weak"
save "us20_anes_parmest_swd_winner_weak_vote.dta", replace


*************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (LOSERS, CARE) **
*************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_loser_strong_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen strength = "strong"
save "us96_anes_parmest_swd_loser_strong_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_loser_strong_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen strength = "strong"
save "us00_anes_parmest_swd_loser_strong_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_loser_strong_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen strength = "strong"
save "us04_anes_parmest_swd_loser_strong_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_loser_strong_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen strength = "strong"
save "us12_anes_parmest_swd_loser_strong_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_loser_strong_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen strength = "strong"
save "us16_anes_parmest_swd_loser_strong_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_loser_strong_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen strength = "strong"
save "us20_anes_parmest_swd_loser_strong_vote.dta", replace


**************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (WINNERS, CARE) **
**************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_swd_winner_strong_vote.dta", clear
gen electionid = "us1996"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen strength = "strong"
save "us96_anes_parmest_swd_winner_strong_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_swd_winner_strong_vote.dta", clear
gen electionid = "us2000"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen strength = "strong"
save "us00_anes_parmest_swd_winner_strong_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_swd_winner_strong_vote.dta", clear
gen electionid = "us2004"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen strength = "strong"
save "us04_anes_parmest_swd_winner_strong_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_swd_winner_strong_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen strength = "strong"
save "us12_anes_parmest_swd_winner_strong_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_swd_winner_strong_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen strength = "strong"
save "us16_anes_parmest_swd_winner_strong_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_swd_winner_strong_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen strength = "strong"
save "us20_anes_parmest_swd_winner_strong_vote.dta", replace

* Append and save

use "us96_anes_parmest_swd_loser_weak_vote.dta", clear
append using "us96_anes_parmest_swd_winner_weak_vote.dta"
append using "us96_anes_parmest_swd_loser_strong_vote.dta"
append using "us96_anes_parmest_swd_winner_strong_vote.dta"
append using "us00_anes_parmest_swd_loser_weak_vote.dta"
append using "us00_anes_parmest_swd_winner_weak_vote.dta"
append using "us00_anes_parmest_swd_loser_strong_vote.dta"
append using "us00_anes_parmest_swd_winner_strong_vote.dta"
append using "us04_anes_parmest_swd_loser_weak_vote.dta"
append using "us04_anes_parmest_swd_winner_weak_vote.dta"
append using "us04_anes_parmest_swd_loser_strong_vote.dta"
append using "us04_anes_parmest_swd_winner_strong_vote.dta"
append using "us12_anes_parmest_swd_loser_weak_vote.dta"
append using "us12_anes_parmest_swd_winner_weak_vote.dta"
append using "us12_anes_parmest_swd_loser_strong_vote.dta"
append using "us12_anes_parmest_swd_winner_strong_vote.dta"
append using "us16_anes_parmest_swd_loser_weak_vote.dta"
append using "us16_anes_parmest_swd_winner_weak_vote.dta"
append using "us16_anes_parmest_swd_loser_strong_vote.dta"
append using "us16_anes_parmest_swd_winner_strong_vote.dta"
append using "us20_anes_parmest_swd_loser_weak_vote.dta"
append using "us20_anes_parmest_swd_winner_weak_vote.dta"
append using "us20_anes_parmest_swd_loser_strong_vote.dta"
append using "us20_anes_parmest_swd_winner_strong_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_swd_strength_vote.dta", replace


**********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (LOSERS, INCONGRUENT) **
**********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_integrity_loser_incongruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen congruent = "incongruent"
save "us9604_anes_parmest_integrity_loser_incongruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_integrity_loser_incongruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen congruent = "incongruent"
save "us1220_anes_parmest_integrity_loser_incongruent_3x_vote.dta", replace


***********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (NO VOTE, INCONGRUENT) **
***********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_integrity_novote_incongruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen congruent = "incongruent"
save "us9604_anes_parmest_integrity_novote_incongruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_integrity_novote_incongruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen congruent = "incongruent"
save "us1220_anes_parmest_integrity_novote_incongruent_3x_vote.dta", replace


***********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (WINNERS, INCONGRUENT) **
***********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_integrity_winner_incongruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen congruent = "incongruent"
save "us9604_anes_parmest_integrity_winner_incongruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_integrity_winner_incongruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen congruent = "incongruent"
save "us1220_anes_parmest_integrity_winner_incongruent_3x_vote.dta", replace


********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (LOSERS, CONGRUENT) **
********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_integrity_loser_congruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "integrity"
gen comp = "losers"
gen congruent = "congruent"
save "us9604_anes_parmest_integrity_loser_congruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_integrity_loser_congruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
gen congruent = "congruent"
save "us1220_anes_parmest_integrity_loser_congruent_3x_vote.dta", replace


*********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (NO VOTE, CONGRUENT) **
*********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_integrity_novote_congruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "integrity"
gen comp = "Non voters"
gen congruent = "congruent"
save "us9604_anes_parmest_integrity_novote_congruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_integrity_novote_congruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
gen congruent = "congruent"
save "us1220_anes_parmest_integrity_novote_congruent_3x_vote.dta", replace


*********************************************************************************
** EXPECTED-UNEXPECTED GAP: PERCEIVED ELECTORAL INTEGRITY (WINNERS, CONGRUENT) **
*********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_integrity_winner_congruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "integrity"
gen comp = "winners"
gen congruent = "congruent"
save "us9604_anes_parmest_integrity_winner_congruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_integrity_winner_congruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
gen congruent = "congruent"
save "us1220_anes_parmest_integrity_winner_congruent_3x_vote.dta", replace

* Append and save

use "us9604_anes_parmest_integrity_loser_incongruent_vote.dta", clear
append using "us9604_anes_parmest_integrity_novote_incongruent_vote.dta"
append using "us9604_anes_parmest_integrity_winner_incongruent_vote.dta"
append using "us9604_anes_parmest_integrity_novote_congruent_vote.dta"
append using "us9604_anes_parmest_integrity_loser_congruent_vote.dta"
append using "us9604_anes_parmest_integrity_winner_congruent_vote.dta"
append using "us1220_anes_parmest_integrity_loser_incongruent_3x_vote.dta"
append using "us1220_anes_parmest_integrity_novote_incongruent_3x_vote.dta"
append using "us1220_anes_parmest_integrity_winner_incongruent_3x_vote.dta"
append using "us1220_anes_parmest_integrity_loser_congruent_3x_vote.dta"
append using "us1220_anes_parmest_integrity_novote_congruent_3x_vote.dta"
append using "us1220_anes_parmest_integrity_winner_congruent_3x_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_integrity_congruent_3x_vote.dta", replace


********************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (LOSERS, INCONGRUENT) **
********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_swd_loser_incongruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen congruent = "incongruent"
save "us9604_anes_parmest_swd_loser_incongruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_swd_loser_incongruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen congruent = "incongruent"
save "us1220_anes_parmest_swd_loser_incongruent_3x_vote.dta", replace


*********************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (NO VOTE, INCONGRUENT) **
*********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_swd_novote_incongruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen congruent = "incongruent"
save "us9604_anes_parmest_swd_novote_incongruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_swd_novote_incongruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen congruent = "incongruent"
save "us1220_anes_parmest_swd_novote_incongruent_3x_vote.dta", replace


*********************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (WINNERS, INCONGRUENT) **
*********************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_swd_winner_incongruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen congruent = "incongruent"
save "us9604_anes_parmest_swd_winner_incongruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_swd_winner_incongruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen congruent = "incongruent"
save "us1220_anes_parmest_swd_winner_incongruent_3x_vote.dta", replace


******************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (LOSERS, CONGRUENT) **
******************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_swd_loser_congruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "swd"
gen comp = "losers"
gen congruent = "congruent"
save "us9604_anes_parmest_swd_loser_congruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_swd_loser_congruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
gen congruent = "congruent"
save "us1220_anes_parmest_swd_loser_congruent_3x_vote.dta", replace


*******************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (NO VOTE, CONGRUENT) **
*******************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_swd_novote_congruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "swd"
gen comp = "Non voters"
gen congruent = "congruent"
save "us9604_anes_parmest_swd_novote_congruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_swd_novote_congruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
gen congruent = "congruent"
save "us1220_anes_parmest_swd_novote_congruent_3x_vote.dta", replace


*******************************************************************************
** EXPECTED-UNEXPECTED GAP: SATISFACTION WITH DEMOCRACY (WINNERS, CONGRUENT) **
*******************************************************************************

* 1996-2004 American National Election Studies

use "us9604_anes_parmest_swd_winner_congruent_vote.dta", clear
gen electionid = "us1996-2004"
gen model = "base"
gen dv = "swd"
gen comp = "winners"
gen congruent = "congruent"
save "us9604_anes_parmest_swd_winner_congruent_vote.dta", replace

* 2012-2020 American National Election Studies

use "us1220_anes_parmest_swd_winner_congruent_3x_vote.dta", clear
gen electionid = "us2012-2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
gen congruent = "congruent"
save "us1220_anes_parmest_swd_winner_congruent_3x_vote.dta", replace

* Append and save

use "us9604_anes_parmest_swd_loser_incongruent_vote.dta", clear
append using "us9604_anes_parmest_swd_novote_incongruent_vote.dta"
append using "us9604_anes_parmest_swd_winner_incongruent_vote.dta"
append using "us9604_anes_parmest_swd_novote_congruent_vote.dta"
append using "us9604_anes_parmest_swd_loser_congruent_vote.dta"
append using "us9604_anes_parmest_swd_winner_congruent_vote.dta"
append using "us1220_anes_parmest_swd_loser_incongruent_3x_vote.dta"
append using "us1220_anes_parmest_swd_novote_incongruent_3x_vote.dta"
append using "us1220_anes_parmest_swd_winner_incongruent_3x_vote.dta"
append using "us1220_anes_parmest_swd_loser_congruent_3x_vote.dta"
append using "us1220_anes_parmest_swd_novote_congruent_3x_vote.dta"
append using "us1220_anes_parmest_swd_winner_congruent_3x_vote.dta"
encode electionid, generate(elid)
save "parmest_inter_swd_congruent_3x_vote.dta", replace


*************************************************************************
** EXPECTED-UNEXPECTED GAP: POST, SATISFACTION WITH DEMOCRACY (LOSERS) **
*************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
gen electionid = "us1996"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us96_anes_parmest_post_suspicion_swd_loser_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2000"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us00_anes_parmest_post_suspicion_swd_loser_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2004"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us04_anes_parmest_post_suspicion_swd_loser_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us12_anes_parmest_post_suspicion_swd_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us16_anes_parmest_post_suspicion_swd_loser_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us20_anes_parmest_post_suspicion_swd_loser_vote.dta", replace


**************************************************************************
** EXPECTED-UNEXPECTED GAP: POST, SATISFACTION WITH DEMOCRACY (NO VOTE) **
**************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_post_suspicion_swd_novote_vote.dta", clear
gen electionid = "us1996"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us96_anes_parmest_post_suspicion_swd_novote_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_post_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2000"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us00_anes_parmest_post_suspicion_swd_novote_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_post_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2004"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us04_anes_parmest_post_suspicion_swd_novote_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_post_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us12_anes_parmest_post_suspicion_swd_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_post_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us16_anes_parmest_post_suspicion_swd_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_post_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us20_anes_parmest_post_suspicion_swd_novote_vote.dta", replace


**************************************************************************
** EXPECTED-UNEXPECTED GAP: POST, SATISFACTION WITH DEMOCRACY (WINNERS) **
**************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_post_suspicion_swd_winner_vote.dta", clear
gen electionid = "us1996"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us96_anes_parmest_post_suspicion_swd_winner_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_post_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2000"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us00_anes_parmest_post_suspicion_swd_winner_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_post_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2004"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us04_anes_parmest_post_suspicion_swd_winner_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_post_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us12_anes_parmest_post_suspicion_swd_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_post_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us16_anes_parmest_post_suspicion_swd_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_post_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us20_anes_parmest_post_suspicion_swd_winner_vote.dta", replace

* Append and save

use "us96_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
append using "us96_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us96_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us00_anes_parmest_post_suspicion_swd_loser_vote.dta"
append using "us00_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us00_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us04_anes_parmest_post_suspicion_swd_loser_vote.dta"
append using "us04_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us04_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us12_anes_parmest_post_suspicion_swd_loser_vote.dta"
append using "us12_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us12_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us16_anes_parmest_post_suspicion_swd_loser_vote.dta"
append using "us16_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us16_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us20_anes_parmest_post_suspicion_swd_loser_vote.dta"
append using "us20_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us20_anes_parmest_post_suspicion_swd_winner_vote.dta"
encode electionid, generate(elid)
save "parmest_post_inter_swd_vote.dta", replace


***************************************************************************
** EXPECTED-UNEXPECTED GAP: POST, PERCEIVED ELECTORAL INTEGRITY (LOSERS) **
***************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us1996"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us96_anes_parmest_post_suspicion_integrity_loser_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2000"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us00_anes_parmest_post_suspicion_integrity_loser_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2004"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us04_anes_parmest_post_suspicion_integrity_loser_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us12_anes_parmest_post_suspicion_integrity_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us16_anes_parmest_post_suspicion_integrity_loser_vote.dta", replace

* 2012 American National Election Study

use "us20_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us20_anes_parmest_post_suspicion_integrity_loser_vote.dta", replace


****************************************************************************
** EXPECTED-UNEXPECTED GAP: POST, PERCEIVED ELECTORAL INTEGRITY (NO VOTE) **
****************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_post_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us1996"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us96_anes_parmest_post_suspicion_integrity_novote_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_post_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2000"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us00_anes_parmest_post_suspicion_integrity_novote_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_post_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2004"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us04_anes_parmest_post_suspicion_integrity_novote_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_post_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us12_anes_parmest_post_suspicion_integrity_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_post_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us16_anes_parmest_post_suspicion_integrity_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_post_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us20_anes_parmest_post_suspicion_integrity_novote_vote.dta", replace


****************************************************************************
** EXPECTED-UNEXPECTED GAP: POST, PERCEIVED ELECTORAL INTEGRITY (WINNERS) **
****************************************************************************

* 1996 American National Election Study

use "us96_anes_parmest_post_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us1996"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us96_anes_parmest_post_suspicion_integrity_winner_vote.dta", replace

* 2000 American National Election Study

use "us00_anes_parmest_post_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2000"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us00_anes_parmest_post_suspicion_integrity_winner_vote.dta", replace

* 2004 American National Election Study

use "us04_anes_parmest_post_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2004"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us04_anes_parmest_post_suspicion_integrity_winner_vote.dta", replace

* 2012 American National Election Study

use "us12_anes_parmest_post_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us12_anes_parmest_post_suspicion_integrity_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_post_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us16_anes_parmest_post_suspicion_integrity_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_post_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us20_anes_parmest_post_suspicion_integrity_winner_vote.dta", replace

* Append and save

use "us96_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
append using "us96_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us96_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us00_anes_parmest_post_suspicion_integrity_loser_vote.dta"
append using "us00_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us00_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us04_anes_parmest_post_suspicion_integrity_loser_vote.dta"
append using "us04_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us04_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us12_anes_parmest_post_suspicion_integrity_loser_vote.dta"
append using "us12_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us12_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us16_anes_parmest_post_suspicion_integrity_loser_vote.dta"
append using "us16_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us16_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us20_anes_parmest_post_suspicion_integrity_loser_vote.dta"
append using "us20_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us20_anes_parmest_post_suspicion_integrity_winner_vote.dta"
encode electionid, generate(elid)
save "parmest_post_inter_integrity_vote.dta", replace


****************************************************************************
** EXPECTED-UNEXPECTED GAP: PREPOST, SATISFACTION WITH DEMOCRACY (LOSERS) **
****************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_prepost_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us12_anes_parmest_prepost_suspicion_swd_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_prepost_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us16_anes_parmest_prepost_suspicion_swd_loser_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_prepost_suspicion_swd_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "losers"
save "us20_anes_parmest_prepost_suspicion_swd_loser_vote.dta", replace


*****************************************************************************
** EXPECTED-UNEXPECTED GAP: PREPOST, SATISFACTION WITH DEMOCRACY (NO VOTE) **
*****************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_prepost_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us12_anes_parmest_prepost_suspicion_swd_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_prepost_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us16_anes_parmest_prepost_suspicion_swd_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_prepost_suspicion_swd_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "Non voters"
save "us20_anes_parmest_prepost_suspicion_swd_novote_vote.dta", replace


*****************************************************************************
** EXPECTED-UNEXPECTED GAP: PREPOST, SATISFACTION WITH DEMOCRACY (WINNERS) **
*****************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_prepost_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us12_anes_parmest_prepost_suspicion_swd_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_prepost_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us16_anes_parmest_prepost_suspicion_swd_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_prepost_suspicion_swd_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "swd"
gen comp = "winners"
save "us20_anes_parmest_prepost_suspicion_swd_winner_vote.dta", replace

* Append and save

use "us96_anes_parmest_post_suspicion_swd_loser_vote.dta", clear
append using "us96_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us96_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us00_anes_parmest_post_suspicion_swd_loser_vote.dta"
append using "us00_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us00_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us04_anes_parmest_post_suspicion_swd_loser_vote.dta"
append using "us04_anes_parmest_post_suspicion_swd_novote_vote.dta"
append using "us04_anes_parmest_post_suspicion_swd_winner_vote.dta"
append using "us12_anes_parmest_prepost_suspicion_swd_loser_vote.dta"
append using "us12_anes_parmest_prepost_suspicion_swd_novote_vote.dta"
append using "us12_anes_parmest_prepost_suspicion_swd_winner_vote.dta"
append using "us16_anes_parmest_prepost_suspicion_swd_loser_vote.dta"
append using "us16_anes_parmest_prepost_suspicion_swd_novote_vote.dta"
append using "us16_anes_parmest_prepost_suspicion_swd_winner_vote.dta"
append using "us20_anes_parmest_prepost_suspicion_swd_loser_vote.dta"
append using "us20_anes_parmest_prepost_suspicion_swd_novote_vote.dta"
append using "us20_anes_parmest_prepost_suspicion_swd_winner_vote.dta"
encode electionid, generate(elid)
save "parmest_prepost_inter_swd_vote.dta", replace


******************************************************************************
** EXPECTED-UNEXPECTED GAP: PREPOST, PERCEIVED ELECTORAL INTEGRITY (LOSERS) **
******************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_prepost_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us12_anes_parmest_prepost_suspicion_integrity_loser_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_prepost_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us16_anes_parmest_prepost_suspicion_integrity_loser_vote.dta", replace

* 2012 American National Election Study

use "us20_anes_parmest_prepost_suspicion_integrity_loser_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "losers"
save "us20_anes_parmest_prepost_suspicion_integrity_loser_vote.dta", replace


*******************************************************************************
** EXPECTED-UNEXPECTED GAP: PREPOST, PERCEIVED ELECTORAL INTEGRITY (NO VOTE) **
*******************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_prepost_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us12_anes_parmest_prepost_suspicion_integrity_novote_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_prepost_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us16_anes_parmest_prepost_suspicion_integrity_novote_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_prepost_suspicion_integrity_novote_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "Non voters"
save "us20_anes_parmest_prepost_suspicion_integrity_novote_vote.dta", replace


*******************************************************************************
** EXPECTED-UNEXPECTED GAP: PREPOST, PERCEIVED ELECTORAL INTEGRITY (WINNERS) **
*******************************************************************************

* 2012 American National Election Study

use "us12_anes_parmest_prepost_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2012"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us12_anes_parmest_prepost_suspicion_integrity_winner_vote.dta", replace

* 2016 American National Election Study

use "us16_anes_parmest_prepost_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2016"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us16_anes_parmest_prepost_suspicion_integrity_winner_vote.dta", replace

* 2020 American National Election Study

use "us20_anes_parmest_prepost_suspicion_integrity_winner_vote.dta", clear
gen electionid = "us2020"
gen model = "suspicion"
gen dv = "integrity"
gen comp = "winners"
save "us20_anes_parmest_prepost_suspicion_integrity_winner_vote.dta", replace

* Append and save

use "us96_anes_parmest_post_suspicion_integrity_loser_vote.dta", clear
append using "us96_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us96_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us00_anes_parmest_post_suspicion_integrity_loser_vote.dta"
append using "us00_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us00_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us04_anes_parmest_post_suspicion_integrity_loser_vote.dta"
append using "us04_anes_parmest_post_suspicion_integrity_novote_vote.dta"
append using "us04_anes_parmest_post_suspicion_integrity_winner_vote.dta"
append using "us12_anes_parmest_prepost_suspicion_integrity_loser_vote.dta"
append using "us12_anes_parmest_prepost_suspicion_integrity_novote_vote.dta"
append using "us12_anes_parmest_prepost_suspicion_integrity_winner_vote.dta"
append using "us16_anes_parmest_prepost_suspicion_integrity_loser_vote.dta"
append using "us16_anes_parmest_prepost_suspicion_integrity_novote_vote.dta"
append using "us16_anes_parmest_prepost_suspicion_integrity_winner_vote.dta"
append using "us20_anes_parmest_prepost_suspicion_integrity_loser_vote.dta"
append using "us20_anes_parmest_prepost_suspicion_integrity_novote_vote.dta"
append using "us20_anes_parmest_prepost_suspicion_integrity_winner_vote.dta"
encode electionid, generate(elid)
save "parmest_prepost_inter_integrity_vote.dta", replace


*************
** COMBINE **
*************

use "us96_anes_parmest_swd_loser_vote.dta", clear
append using "us96_anes_parmest_swd_novote_vote.dta"
append using "us96_anes_parmest_swd_winner_vote.dta"
append using "us96_anes_parmest_integrity_loser_vote.dta"
append using "us96_anes_parmest_integrity_novote_vote.dta"
append using "us96_anes_parmest_integrity_winner_vote.dta"
append using "us00_anes_parmest_swd_loser_vote.dta"
append using "us00_anes_parmest_swd_novote_vote.dta"
append using "us00_anes_parmest_swd_winner_vote.dta"
append using "us00_anes_parmest_integrity_loser_vote.dta"
append using "us00_anes_parmest_integrity_novote_vote.dta"
append using "us00_anes_parmest_integrity_winner_vote.dta"
append using "us04_anes_parmest_swd_loser_vote.dta"
append using "us04_anes_parmest_swd_novote_vote.dta"
append using "us04_anes_parmest_swd_winner_vote.dta"
append using "us04_anes_parmest_integrity_loser_vote.dta"
append using "us04_anes_parmest_integrity_novote_vote.dta"
append using "us04_anes_parmest_integrity_winner_vote.dta"
append using "us12_anes_parmest_swd_loser_vote.dta"
append using "us12_anes_parmest_swd_novote_vote.dta"
append using "us12_anes_parmest_swd_winner_vote.dta"
append using "us12_anes_parmest_integrity_loser_vote.dta"
append using "us12_anes_parmest_integrity_novote_vote.dta"
append using "us12_anes_parmest_integrity_winner_vote.dta"
append using "us16_anes_parmest_swd_loser_vote.dta"
append using "us16_anes_parmest_swd_novote_vote.dta"
append using "us16_anes_parmest_swd_winner_vote.dta"
append using "us16_anes_parmest_integrity_loser_vote.dta"
append using "us16_anes_parmest_integrity_novote_vote.dta"
append using "us16_anes_parmest_integrity_winner_vote.dta"
append using "us20_anes_parmest_swd_loser_vote.dta"
append using "us20_anes_parmest_swd_novote_vote.dta"
append using "us20_anes_parmest_swd_winner_vote.dta"
append using "us20_anes_parmest_integrity_loser_vote.dta"
append using "us20_anes_parmest_integrity_novote_vote.dta"
append using "us20_anes_parmest_integrity_winner_vote.dta"
gen elset = 1 if electionid == "us1996" | electionid == "us2000" | electionid == "us2004"
replace elset = 2 if electionid == "us2012" | electionid == "us2016" | electionid == "us2020"
gen elid=.
replace elid = 1 if electionid == "us1996"
replace elid = 2 if electionid == "us2000"
replace elid = 3 if electionid == "us2004"
replace elid = 5 if electionid == "us2012"
replace elid = 6 if electionid == "us2016"
replace elid = 7 if electionid == "us2020"
save "parmest_inter_vote.dta", replace

use "us12_anes_parmest_swd_loser_3x_vote.dta", clear
append using "us12_anes_parmest_swd_novote_3x_vote.dta"
append using "us12_anes_parmest_swd_winner_3x_vote.dta"
append using "us12_anes_parmest_integrity_loser_3x_vote.dta"
append using "us12_anes_parmest_integrity_novote_3x_vote.dta"
append using "us12_anes_parmest_integrity_winner_3x_vote.dta"
append using "us16_anes_parmest_swd_loser_3x_vote.dta"
append using "us16_anes_parmest_swd_novote_3x_vote.dta"
append using "us16_anes_parmest_swd_winner_3x_vote.dta"
append using "us16_anes_parmest_integrity_loser_3x_vote.dta"
append using "us16_anes_parmest_integrity_novote_3x_vote.dta"
append using "us16_anes_parmest_integrity_winner_3x_vote.dta"
append using "us20_anes_parmest_swd_loser_3x_vote.dta"
append using "us20_anes_parmest_swd_novote_3x_vote.dta"
append using "us20_anes_parmest_swd_winner_3x_vote.dta"
append using "us20_anes_parmest_integrity_loser_3x_vote.dta"
append using "us20_anes_parmest_integrity_novote_3x_vote.dta"
append using "us20_anes_parmest_integrity_winner_3x_vote.dta"

gen elid=.
replace elid = 1 if electionid == "us2012"
replace elid = 2 if electionid == "us2016"
replace elid = 3 if electionid == "us2020"
save "parmest_inter_3x_vote.dta", replace

use "parmest_inter_integrity_vote.dta", clear
append using "parmest_inter_swd_vote.dta"
save "parmest_inter_integrity_swd_vote.dta", replace

use "parmest_post_inter_integrity_vote.dta", clear
append using "parmest_post_inter_swd_vote.dta"
save "parmest_post_inter_integrity_swd_vote.dta", replace

use "parmest_prepost_inter_integrity_vote.dta", clear
append using "parmest_prepost_inter_swd_vote.dta"
save "parmest_prepost_inter_integrity_swd_vote.dta", replace

log close